Merge ~ack/maas:fix-fabric-id-sequence-3.4.0 into maas:branch-3.4.0

Proposed by Alberto Donato
Status: Merged
Approved by: Alberto Donato
Approved revision: aa972f9d501b03fed8ea866a8bdd4b1eb5241d24
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~ack/maas:fix-fabric-id-sequence-3.4.0
Merge into: maas:branch-3.4.0
Diff against target: 138 lines (+20/-35)
5 files modified
src/maasserver/migrations/maasserver/0302_big_auto_field.py (+0/-25)
src/maasserver/models/domain.py (+5/-3)
src/maasserver/models/fabric.py (+6/-1)
src/maasserver/models/globaldefault.py (+4/-3)
src/maasserver/models/resourcepool.py (+5/-3)
Reviewer Review Type Date Requested Status
MAAS Lander Needs Fixing
Alberto Donato (community) Approve
Review via email: mp+452283@code.launchpad.net

Commit message

LP:2037524 fix bigint migration for IDs, exclude Fabric since 0 value is used there too

backport of ba319aecf from master

To post a comment you must log in.
Revision history for this message
Alberto Donato (ack) :
review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b fix-fabric-id-sequence-3.4.0 lp:~ack/maas/+git/maas into -b branch-3.4.0 lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci.internal:8080/job/maas-tester/3660/console
COMMIT: aa972f9d501b03fed8ea866a8bdd4b1eb5241d24

review: Needs Fixing
Revision history for this message
MAAS Lander (maas-lander) wrote :

LANDING
-b fix-fabric-id-sequence-3.4.0 lp:~ack/maas/+git/maas into -b branch-3.4.0 lp:~maas-committers/maas

STATUS: FAILED BUILD
LOG: http://maas-ci.internal:8080/job/maas-tester/3662/console

Revision history for this message
MAAS Lander (maas-lander) wrote :

LANDING
-b fix-fabric-id-sequence-3.4.0 lp:~ack/maas/+git/maas into -b branch-3.4.0 lp:~maas-committers/maas

STATUS: FAILED BUILD
LOG: http://maas-ci.internal:8080/job/maas-tester/3663/console

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/migrations/maasserver/0302_big_auto_field.py b/src/maasserver/migrations/maasserver/0302_big_auto_field.py
2index 73ebf4f..6fb411e 100644
3--- a/src/maasserver/migrations/maasserver/0302_big_auto_field.py
4+++ b/src/maasserver/migrations/maasserver/0302_big_auto_field.py
5@@ -164,11 +164,6 @@ class Migration(migrations.Migration):
6 ),
7 ),
8 migrations.AlterField(
9- model_name="domain",
10- name="id",
11- field=models.AutoField(primary_key=True, serialize=False),
12- ),
13- migrations.AlterField(
14 model_name="event",
15 name="id",
16 field=models.BigAutoField(
17@@ -189,16 +184,6 @@ class Migration(migrations.Migration):
18 ),
19 ),
20 migrations.AlterField(
21- model_name="fabric",
22- name="id",
23- field=models.BigAutoField(
24- auto_created=True,
25- primary_key=True,
26- serialize=False,
27- verbose_name="ID",
28- ),
29- ),
30- migrations.AlterField(
31 model_name="filestorage",
32 name="id",
33 field=models.BigAutoField(
34@@ -239,11 +224,6 @@ class Migration(migrations.Migration):
35 ),
36 ),
37 migrations.AlterField(
38- model_name="globaldefault",
39- name="id",
40- field=models.AutoField(primary_key=True, serialize=False),
41- ),
42- migrations.AlterField(
43 model_name="interface",
44 name="id",
45 field=models.BigAutoField(
46@@ -564,11 +544,6 @@ class Migration(migrations.Migration):
47 ),
48 ),
49 migrations.AlterField(
50- model_name="resourcepool",
51- name="id",
52- field=models.AutoField(primary_key=True, serialize=False),
53- ),
54- migrations.AlterField(
55 model_name="rootkey",
56 name="id",
57 field=models.BigAutoField(
58diff --git a/src/maasserver/models/domain.py b/src/maasserver/models/domain.py
59index 5dccc9f..d1fa27d 100644
60--- a/src/maasserver/models/domain.py
61+++ b/src/maasserver/models/domain.py
62@@ -180,9 +180,11 @@ class Domain(CleanSave, TimestampedModel):
63
64 objects = DomainManager()
65
66- # explicitly define the AutoField since default is BigAutoField which
67- # doesn't allow 0 as a value (used for the default domain)
68- id = AutoField(primary_key=True)
69+ # explicitly define the AutoField since default is BigAutoField and causing
70+ # modifications causes django to include this in the migration and not
71+ # allowing 0 as a value
72+ id = AutoField(primary_key=True, auto_created=True, verbose_name="ID")
73+
74 name = DomainNameField(
75 max_length=256,
76 editable=True,
77diff --git a/src/maasserver/models/fabric.py b/src/maasserver/models/fabric.py
78index 209a9ad..76bc8e1 100644
79--- a/src/maasserver/models/fabric.py
80+++ b/src/maasserver/models/fabric.py
81@@ -8,7 +8,7 @@ from operator import attrgetter
82 import re
83
84 from django.core.exceptions import PermissionDenied, ValidationError
85-from django.db.models import CharField, Manager, TextField
86+from django.db.models import AutoField, CharField, Manager, TextField
87 from django.db.models.query import QuerySet
88
89 from maasserver.fields import MODEL_NAME_VALIDATOR
90@@ -133,6 +133,11 @@ class Fabric(CleanSave, TimestampedModel):
91
92 objects = FabricManager()
93
94+ # explicitly define the AutoField since default is BigAutoField and causing
95+ # modifications causes django to include this in the migration and not
96+ # allowing 0 as a value
97+ id = AutoField(primary_key=True, auto_created=True, verbose_name="ID")
98+
99 # We don't actually allow blank or null name, but that is enforced in
100 # clean() and save().
101 name = CharField(
102diff --git a/src/maasserver/models/globaldefault.py b/src/maasserver/models/globaldefault.py
103index 8bf5991..5468504 100644
104--- a/src/maasserver/models/globaldefault.py
105+++ b/src/maasserver/models/globaldefault.py
106@@ -37,9 +37,10 @@ class GlobalDefault(CleanSave, TimestampedModel):
107
108 objects = GlobalDefaultManager()
109
110- # explicitly define the AutoField since default is BigAutoField which
111- # doesn't allow 0 as a value
112- id = AutoField(primary_key=True)
113+ # explicitly define the AutoField since default is BigAutoField and causing
114+ # modifications causes django to include this in the migration and not
115+ # allowing 0 as a value
116+ id = AutoField(primary_key=True, auto_created=True, verbose_name="ID")
117
118 domain = ForeignKey(
119 Domain, null=False, blank=False, editable=True, on_delete=PROTECT
120diff --git a/src/maasserver/models/resourcepool.py b/src/maasserver/models/resourcepool.py
121index fed6f34..f6012a1 100644
122--- a/src/maasserver/models/resourcepool.py
123+++ b/src/maasserver/models/resourcepool.py
124@@ -108,9 +108,11 @@ class ResourcePool(CleanSave, TimestampedModel):
125
126 objects = ResourcePoolManager()
127
128- # explicitly define the AutoField since default is BigAutoField which
129- # doesn't allow 0 as a value (used for the default resource pool)
130- id = AutoField(primary_key=True)
131+ # explicitly define the AutoField since default is BigAutoField and causing
132+ # modifications causes django to include this in the migration and not
133+ # allowing 0 as a value
134+ id = AutoField(primary_key=True, auto_created=True, verbose_name="ID")
135+
136 name = CharField(
137 max_length=256,
138 unique=True,

Subscribers

People subscribed via source and target branches