Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We now use `sqlx` ([1]) and its CLI ([2]) to manage our SQL schema and migrate it to new versions. The schema is now represented as a series of SQL scripts in `db/`, along with teardown scripts to enable rollbacks. The objective here is to enable easy migrations, namely: - adding new tables - adding indices to tables - adding columns with default values to tables More complex migrations which transform or delete data may require more sophisticated tools than what's here, and even these "easy" migrations require some planning and operational tools that aren't present in this repository. This commit contains these changes: - the `publish-sql-schema` workflow now publishes all migration scripts in `db` to a Google Cloud Storage bucket to later be consumed by Divvi Up ops tools - the interop test containers use `sqlx::migrate::Migrator` instead of `janus_cli` to write the schema into their database - `janus_aggregator_core::datastore::test_util::ephemeral_dataastore` uses `sqlx::migrate::Migrator` to apply migrations to ephemeral databases - `db/schema.sql` is copied to a `sqlx` migration script, and a corresponding `down` script is added which deletes tables, indices, etc. [1]: https://crates.io/crates/sqlx [2]: https://crates.io/crates/sqlx-cli Part of #30
- Loading branch information