Skip to content

feat: Adds migrate --repair command to CLI. - #980

Merged
vlidholt merged 3 commits into
serverpod:mainfrom
vlidholt:migration-repair
Jun 1, 2023
Merged

vlidholt merged 3 commits into
serverpod:mainfrom
vlidholt:migration-repair

Conversation

@vlidholt

@vlidholt vlidholt commented Jun 1, 2023

Copy link
Copy Markdown
Collaborator

This PR adds a repair option to the serverpod migrate command.

Example usage:
serverpod migrate --repair --mode production

The command will connect to the insights server and retrieve the structure of the database. The structure is compared with what is expected from the most up-to-date migrations (including modules). If the database is out of sync, the command will output the SQL queries required to synchronize the database with the latest migration. If any destructive changes are detected, warnings will be written and the --force option will need to be added to output the SQL code.

Pre-launch Checklist

  • I read the Contribute page and followed the process outlined there for submitting PRs.
  • This update contains only one single feature or bug fix and nothing else. (If you are submitting multiple fixes, please make multiple PRs.)
  • I read and followed the Dart Style Guide and formatted the code with dart format.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///), and made sure that the documentation follows the same style as other Serverpod documentation. I checked spelling and grammar.
  • I added new tests to check the change I am making.
  • All existing and new tests are passing.
  • Any breaking changes are documented below.

If you need help, consider asking for advice on the discussion board.

Breaking changes

If you have done any breaking changes, make sure to outline them here, so that they can be included in the notes for the next release.

@vlidholt
vlidholt requested a review from Isakdl June 1, 2023 11:22

@Isakdl Isakdl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some NIT comments.

Would be nice with a test too! But otherwise looking good.

@vlidholt
vlidholt merged commit 5b4419f into serverpod:main Jun 1, 2023
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 1, 2023
@vlidholt
vlidholt deleted the migration-repair branch June 1, 2023 14:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants