Skip to content
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

Add custom migration runner, forbid some diesel migration commands, fix old migrations #4673

Draft
wants to merge 50 commits into
base: main
Choose a base branch
from

Conversation

dullbananas
Copy link
Collaborator

@dullbananas dullbananas commented Apr 28, 2024

Reverting and testing migrations will be done with lemmy_server migration commands, and diesel migration commands will do nothing and fail when trying to run or revert migrations.

Benefits:

  • Changes in replaceable_schema will no longer require a corresponding migration
  • Migrations will now be run and reverted without the "r" schema applied, instead of needing to work both with and without it
  • All migrations, not just the newest one, will be tested with schema diff
  • Multiple lemmy_server processes trying to run migrations at the same time will now be prevented
  • Name and duration of each migration will be displayed when run in lemmy_server

#4333 (comment)

The new tests (even just reverting all migrations) revealed some mistakes in old migrations, so I fixed those, and I also discovered that 'now'::timestamp in old views used the timestamp of the view's creation instead of the current timestamp.

@dullbananas dullbananas changed the title Custom migration runner Custom migration runner (diesel migration no longer allowed) Apr 28, 2024
@dullbananas dullbananas changed the title Custom migration runner (diesel migration no longer allowed) Custom migration runner (some diesel migration commands no longer allowed) May 11, 2024
@dullbananas dullbananas changed the title Custom migration runner (some diesel migration commands no longer allowed) Add custom migration runner, forbid some diesel migration commands, fix old migrations May 13, 2024
@dullbananas
Copy link
Collaborator Author

dullbananas commented May 21, 2024

The downgrade instructions will need to be changed to instead use the revert command (e.g. lemmy_server migration --number 3 revert to revert 3 migrations)

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.

None yet

1 participant