Database is created when it doesn't exist using SQLite OPEN_CREATE.
New table _Migrations contains information about migrations in a name-value store
For now, this is only a version field containing the current version.
Initial migration js mirrors the master's schema of the database (plus the new _Migrations table).
Data of the pre-migration db will not be copied on its own. You have to manually delete the discotron.db file OR add the _Migrations table to it manually if you wish to keep your data.
When new migrations are added (placed in bot/migrations folder), they will call up in chronological order once Discotron is started.
down works similarly, but as of now there is no way to downgrade database version.
Migrations may not contain SQL comments, and should always be wrapped in a transaction. Maybe we should automatically do this later on.
Future:
Maybe allow up/down callbacks, so we can use JS code to for example populate new columns instead of having to fiddle with SQL.
See TODO's, we should probably open new issues for them instead.
Fix #69 (nice)
What it does:
OPEN_CREATE
._Migrations
contains information about migrations in a name-value storeversion
field containing the current version._Migrations
table)._Migrations
table to it manually if you wish to keep your data.bot/migrations
folder), they will callup
in chronological order once Discotron is started.down
works similarly, but as of now there is no way to downgrade database version.Future: