Skip to content

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

vnikolova
Copy link
Collaborator

@vnikolova vnikolova commented Apr 25, 2025

Description

Add a new 'Migrations' topic and sample project.
Preview on staging


Type of Change

Please mark the relevant options with an "X":

  • Documentation update

Related Issues

EXPOSED-756

@vnikolova vnikolova requested a review from bog-walk April 25, 2025 13:47
@vnikolova vnikolova self-assigned this Apr 25, 2025
@vnikolova vnikolova marked this pull request as ready for review April 25, 2025 13:48
Copy link
Member

@bog-walk bog-walk left a 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()

@vnikolova
Copy link
Collaborator Author

@bog-walk Thanks for the thorough review! 🙏
I implemented your suggestions, including the "Validating the database schema" section, which only includes brief mentions of the most common methods. Can you please re-review with the new changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants