mirror of
https://github.com/status-im/status-go.git
synced 2025-01-09 14:16:21 +00:00
6f088bb5c5
In some instances the communities migration would be skipped but not marked as `dirty`. This commit addresses the issue by: - Making sure that if dirty is set the migration is not skipped but replayed - If the version is on the communities migration and dirty is false, we check for the presence of the communities table. If not present we replay the communities migration. - Make community_id field in user_messages nullable It also removes all the `down` migration, as we can't use them effectively, as explained in the README.md added.
554 B
554 B
How to write migrations?
We only write up
migrations, down
migrations are not always possible in sqlite or
too complex/too expensive. For example to remove a column you would have to duplicate
the table, copy over the data, delete and recreated.
This can be very expensive for some tables (user_messages for example), so should not be attempted.
Notes
One issue we faced multiple times is that updates to user_messages
can be very
expensive, leading to slow upgrade times and interrupted migrations. So avoid
writes if not necessary.