-
Notifications
You must be signed in to change notification settings - Fork 1
Declarative schema management #241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Jan 5, 2026
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR reworks schema management for Macrostrat database to be based around a declarative representation of the schema. Now, the repository has a unified representation of the Macrostrat schema in the desired state, and tools to test and ensure conformance of each environment to this state. The major benefit of the declarative approach is that there is always a unified representation of the desired state of the schema, making it easier to reason about and modify.
Here, we centralize and merge schema-management tools into three major parts:
We have also moved all schema management tools under a separate
macrostrat schemacommand and moved the migrations and schema SQL files to theschemadirectory to improve their visibility within the repository.The manual migrations system is inherited from the previous approach to schema management, but we expect it now to be used only for complicated migrations that can't be done easily with the automated system. The upshot of this is that it is no longer expected that migrations can fully construct the database in its desired state, and old migrations can be retired once no longer useful.
For automatic schema diffing, we evaluated PGSchema but found it a bit more restrictive than we'd like (although we did borrow the
plan,review,applyworkflow and terminology used by that project). For now, we useresults, which is an update ofmigra, although there is a possibility we may need to move to a different library in the future (see djrobstep/results#7).Several next steps remain:
rockddatabase into the system