Skip to content

Commit 093e510

Browse files
feat(docs): Mention the update script in migration docs (#13385)
* ✏️ docs for migration script * Update develop-docs/backend/application-domains/database-migrations/index.mdx Co-authored-by: Michael Sun <[email protected]> --------- Co-authored-by: Michael Sun <[email protected]>
1 parent 8b7e224 commit 093e510

File tree

1 file changed

+13
-1
lines changed
  • develop-docs/backend/application-domains/database-migrations

1 file changed

+13
-1
lines changed

develop-docs/backend/application-domains/database-migrations/index.mdx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,19 @@ Note that if you have added a new model, you also need to import the model in `_
5454

5555
When merging to master you might notice a conflict with `migrations_lockfile.txt`. This file is in place to help us avoid merging two migrations with the same migration number to master, and if you're conflicting with it then it's likely someone has committed a migration ahead of you.
5656

57-
To resolve this, rebase against latest master, delete your current migration and then regenerate it. If your migration was custom, just save the operations in a text file somewhere so that you can reapply them on the regenerated migration.
57+
### Automatically Resolving Conflicts
58+
59+
There is a [useful script](https://github.com/getsentry/sentry/blob/master/bin/update-migration) for automatically moving your migration to the top of the migration history.
60+
61+
```bash
62+
bin/update-migration <migration_name>
63+
```
64+
65+
It will rename the migration, modify it to depend on the latest migration, and update the lockfile and the name of any tests if they exist.
66+
67+
### Manually Resolving Conflicts
68+
69+
To perform the steps manually, rebase against latest master, delete your current migration and then regenerate it. If your migration was custom, just save the operations in a text file somewhere so that you can reapply them on the regenerated migration.
5870

5971
Always commit the changes to `migrations_lockfile.txt` with your migration.
6072

0 commit comments

Comments
 (0)