superfly / litefs

FUSE-based file system for replicating SQLite databases across a cluster of machines
Apache License 2.0
3.95k stars 95 forks source link

Creating new databases #432

Closed sebbarg closed 4 months ago

sebbarg commented 4 months ago

My program is creating databases on the fly (e.g. user clicks a button, database is created).

I have tested that litefs discovers and is able to replicate the new database on the fly.

But the documentation mentions that I should use import instead of cp to copy a database into place.

Does this mean that I should not count on litefs to pick up "dynamically" created databases?

benbjohnson commented 4 months ago

@sebbarg You only need to use litefs import if you're importing a pre-existing SQLite database file into LiteFS. You can create empty databases on LiteFS using the normal SQLite API. LiteFS replicas will automatically pick up databases created or imported.