Add ability to serialize additional fields to the MigrationMetadata #3332
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We would like to attach additional fields to the
MigrationMetadata
, to give us the ability to manage the migrations in a better fashion.How we'll use it
Our tenants are separated in different schemas, but also there's a shared schema.
Normally we would set the scope for each tenant via
search_path
before running migrations, and try to make the "shared" migrations idempotent, but that's annoyingly complicated and not flexible.By allowing additional fields in the metadata, we would be able to extract a flag like
is_shared
, and only run that in the "global" scope, not once for each tenant.An alternative that we considered for that, would be splitting the two sets of migrations into different folders, and merging the two sets afterwards, but extending the metadata seemed cleaner.