-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[fix] Migrations #763
base: v3
Are you sure you want to change the base?
[fix] Migrations #763
Conversation
# Conflicts: # server/utils/utils.js
See this commit, this fixes the issue where knex was looking for the previous But regarding the migration files, this is how I see them: Keep the current migration files intact. Create new migration files for all the changes you want to make. Edit the models if necessary, this way it's clear what the final form of a model is by looking at that model file. The changes to the models are only applied when Kutt is running for the first time, otherwise, the changes are ignored and applied through the migration files. |
The migration files that were already run should never be executed again by knex. Only new migrations are being executed. All successful migrations are stored in the DB. What I did is revert the migration files to the state before they were applied. All changes were then kept in their respective migration files without the checks, as they are not needed. Just keeping it like this is very bad practice and cause trouble with fresh installations as the migrations are not sequentially. For all existing installations, the changes have no effect as the migrations won't be run again. |
Are you sure that this is enough? I think all existing migrations are still considered "new" by knex as the file extension is stored in the migrations table too. As already mentioned, I don't see any benefits of dropping TS, but it causes trouble like this. I can offer to create a PR and revert the latest v3 back to TS and rebase the PRs, but that's of course your decision. |
# Conflicts: # server/models/index.js # server/queries/link.queries.js
Yes, because the migrations mostly check if the changes are already done or not. For example they only create tables if they have not already been created.
No, I still prefer no TypeScript for now. |
Description:
This PR restructures the migration process to avoid issues where migrations were updated after they’ve already been applied. Updating migrations late leads to failures when running clean migrations, breaking database consistency.
Changes:
models
directory to a dedicatedmigrations
directory.Note:
This PR is based of #762