-
Notifications
You must be signed in to change notification settings - Fork 716
docs: EXPOSED-756 Add documentation for SQL migration options #2471
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the much needed addition!
How about adding another subsection, something like ## Validating the database schema
?
It could be brought up in the 'Aligning' section, since any of the methods mentioned that return the SQL strings could be used as a pre-check (for example, many users check for an empty list first to confirm their Exposed objects haven't been altered).
All of these methods are used by Exposed when generating migration statements or scripts, but they are also part of the lower-level public API in the event users want to control schema validations or integrate their own migration logic. I don't think we'd have to mention all the API, but the most common would be:
- Check for existence of a database object:
Table.exists()
,Sequence.exists()
,Schema.exists()
- Check a table in the database for whether it has more than 1 associated index or foreign key:
SchemaUtils.checkExcessiveIndices()
,SchemaUtils.checkExcessiveForeignKeyConstraints()
- Return metadata information about existing database objects (might be useful for comparisons against Exposed objects):
currentDialect.tableColumns()
,currentDialect.existingIndices()
,currentDialect.existingPrimaryKeys()
@bog-walk Thanks for the thorough review! 🙏 |
Description
Add a new 'Migrations' topic and sample project.
Preview on staging
Type of Change
Please mark the relevant options with an "X":
Related Issues
EXPOSED-756