mirror of
https://github.com/django/django.git
synced 2025-07-23 05:05:17 +00:00
Fixed #24604 -- Added JSONField to contrib.postgres.
This commit is contained in:
parent
74fe4428e5
commit
33ea472f69
11 changed files with 540 additions and 3 deletions
|
@ -150,6 +150,19 @@ class Migration(migrations.Migration):
|
|||
),
|
||||
]
|
||||
|
||||
pg_94_operations = [
|
||||
migrations.CreateModel(
|
||||
name='JSONModel',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('field', JSONField(null=True, blank=True)),
|
||||
],
|
||||
options={
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
]
|
||||
|
||||
def apply(self, project_state, schema_editor, collect_sql=False):
|
||||
try:
|
||||
PG_VERSION = schema_editor.connection.pg_version
|
||||
|
@ -158,4 +171,6 @@ class Migration(migrations.Migration):
|
|||
else:
|
||||
if PG_VERSION >= 90200:
|
||||
self.operations = self.operations + self.pg_92_operations
|
||||
if PG_VERSION >= 90400:
|
||||
self.operations = self.operations + self.pg_94_operations
|
||||
return super(Migration, self).apply(project_state, schema_editor, collect_sql)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue