Skip to content

Commit 14e9837

Browse files
authored
Update index.mdx
1 parent 9dc6d56 commit 14e9837

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
@@ -313,7 +313,7 @@ creating new columns they should either be:
313313

314314
### Adding Columns With a Default
315315

316-
Since we run Postgres >= 14 in production we are able to add columns with a default. To do so, instead of using `default=<your_default>`, instead use `db_default=<your_default>`. This tells Django to set a default at the database level and manage it there, rather than managing it in code.
316+
Since we run Postgres >= 14 in production we are able to add columns with a default. To do so, instead of using `default=<your_default>`, use `db_default=<your_default>`. This tells Django to set a default at the database level and manage it there, rather than managing it in application code.
317317

318318
We can't use `default` because Django's default behaviour for creating a new not null column with a default is dangerous. When using default, in the migration Django will add the default to backfill all fields, then immediately remove it so that it can handle them in the app layer. This means that during a deploy, the column is sitting in production without a default until all code rolls out, which means that inserts will fail for this table until the deploy completes.
319319

0 commit comments

Comments
 (0)