kadena-io / chainweb-data

Data ingestion for Chainweb.
BSD 3-Clause "New" or "Revised" License
14 stars 8 forks source link

Avoid error caused by the schema_migrations table #104

Closed enobayram closed 1 year ago

enobayram commented 1 year ago

In preparation for switching to the script-based migration, we've added the creation of the schema_migrations table to the cw-data start up. However, when we add that table, the next time we start chainweb-data it complains about the need to remove that table, which is obviously not something we intend to do.

This PR filters the calculated migration steps and removes any "TableRemove" step. Note that this should avoid the spurious "DROP schema_migrations" error when the database is otherwise fully migrated, but if there are any additional migrations required, cw-data will still try to perform those migrations using tryRunMigrationsWithEditUpdate, which will in turn error out due to the spurious TableRemove steps. However, since this is supposed to be the final version of cw-data that will perform migrations with beam-automigrate, our users shouldn't ever run into that problem.

enobayram commented 1 year ago

Here's how I've verified this PR:

You can see in the output that it's reporting "No database migration needed" even though the "Initializing the incremental migrations table" step indicates that relation "schema_migrations" already exists.