1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

[4.1.x] Fixed #33919 -- Fixed adding AutoFields on PostgreSQL.

Thanks Jack Calvin Brown for the report.

Regression in 2eea361eff.
Backport of 5c803bc070 from main
This commit is contained in:
Mariusz Felisiak
2022-08-12 17:30:23 +02:00
parent 04ec8bf92a
commit 3848475eeb
3 changed files with 31 additions and 0 deletions

View File

@@ -637,6 +637,8 @@ class BaseDatabaseSchemaEditor:
# It might not actually have a column behind it
if definition is None:
return
if col_type_suffix := field.db_type_suffix(connection=self.connection):
definition += f" {col_type_suffix}"
# Check constraints can go on the column SQL here
db_params = field.db_parameters(connection=self.connection)
if db_params["check"]: