fioprotocol / fio-registrations

FIO protocol domain and address registration
MIT License
5 stars 9 forks source link

Migrating the database #15

Open jcalfee opened 4 years ago

jcalfee commented 4 years ago

Updating the database in a live system

First: always make the change in the sequelize JavaScirpt model definition so it will be available in the code as JavaScript objects (ex: registrations/server/db/models/wallet.js). This makes it much easier to work with the database.

Currently I make the change locally (in my database) then document the DDL (sql changes) in fio-registrations/UPGRADE.md. This works but complicates upgrades because it is manual.

In any event, include any changes in server/db/models/* in UPGRADE.md..

jcalfee commented 4 years ago

The sequelize migrations and seed solution may not play well well new installs and with upgrades. They will tend to run on new installs but the sync target creates all tables after all migrations are applied. Additionally I had an error in the migration when I tried to run raw DDL. I think a custom migration solution may be needed if we are to remove the need to update and run DDL from UPGRADE.md.

jcalfee commented 4 years ago

A migration should either the [major].x.x or x.[minor].x version in package.json (probably the major).