Skip to content

Commit 7841916

Browse files
authored
ref(migrations): Add instructions for hybrid cloud foreign key (#12039)
1 parent dc22562 commit 7841916

File tree

1 file changed

+1
-1
lines changed
  • develop-docs/api-server/application-domains/database-migrations

1 file changed

+1
-1
lines changed

develop-docs/api-server/application-domains/database-migrations/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ Extra care is needed here if the table is referenced as a foreign key in other t
287287

288288
- Make a pull request to remove all uses of the model in the codebase in a separate pull request. This mostly helps with code cleanliness. This should be merged ahead of the migration pull requests, but we don't need to worry about whether it is deployed first.
289289
- Make another pull request to:
290-
- Remove any database level foreign key constraints from this table to other tables by setting `db_constraint=False` on the columns.
290+
- Remove any database level foreign key constraints from this table to other tables by setting `db_constraint=False` on the columns. If it's a hybrid cloud foreign key, set `null=True` instead.
291291
- Remove the model and in the generated migration use `SafeDeleteModel(..., deletion_action=DeletionAction.MOVE_TO_PENDING)` to replace `DeleteModel(...)`. This only marks the state for the model as removed.
292292
- Deploy. It's important that all previous pull requests are in production before we remove the actual table.
293293
- Make a pull request that creates a new migration that has the same `SafeDeleteModel` operation as before, but set `deletion_action=DeletionAction.DELETE` instead. This deletes the actual table from Postgres.

0 commit comments

Comments
 (0)