Skip to content

Commit a4e709a

Browse files
committed
Revert migration changes, reforat migration stages
1 parent 449a2f6 commit a4e709a

File tree

5 files changed

+72
-1
lines changed

5 files changed

+72
-1
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated manually to rename ExternalOrganization table to organizations_organization
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("organizations", "0005_organization"),
10+
]
11+
12+
operations = [
13+
migrations.AlterModelTable(
14+
name="externalorganization",
15+
table="organizations_organization",
16+
),
17+
]

ansible_ai_connect/organizations/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ class ExternalOrganization(models.Model):
3636
telemetry_opt_out = models.BooleanField(default=False, db_column="telemetry_opt_out")
3737
enable_anonymization = models.BooleanField(default=True)
3838

39+
class Meta:
40+
db_table = "organizations_organization"
41+
3942
@property # NOTE: The info dict is already cache in the seat_checker
4043
def name(self):
4144
seat_checker = apps.get_app_config("ai").get_seat_checker()

ansible_ai_connect/users/migrations/0009_user_organization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Migration(migrations.Migration):
2020
default=None,
2121
null=True,
2222
on_delete=django.db.models.deletion.CASCADE,
23-
to="organizations.externalorganization",
23+
to="organizations.organization",
2424
),
2525
),
2626
]

ansible_ai_connect/users/migrations/0017_alter_user_options_team.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class Migration(migrations.Migration):
1212
("users", "0016_user_aap_user"),
1313
]
1414

15+
run_before = [("dab_rbac", "__first__")]
16+
1517
operations = [
1618
migrations.AlterModelOptions(
1719
name="user",
@@ -43,6 +45,15 @@ class Migration(migrations.Migration):
4345
"description",
4446
models.TextField(blank=True, default="", help_text="The team description."),
4547
),
48+
(
49+
"admins",
50+
models.ManyToManyField(
51+
blank=True,
52+
help_text="The list of admins for this team",
53+
related_name="teams_administered",
54+
to=settings.AUTH_USER_MODEL,
55+
),
56+
),
4657
(
4758
"created_by",
4859
models.ForeignKey(
@@ -76,6 +87,21 @@ class Migration(migrations.Migration):
7687
to="organizations.organization",
7788
),
7889
),
90+
(
91+
"team_parents",
92+
models.ManyToManyField(
93+
blank=True, related_name="team_children", to="users.team"
94+
),
95+
),
96+
(
97+
"users",
98+
models.ManyToManyField(
99+
blank=True,
100+
help_text="The list of users on this team",
101+
related_name="teams",
102+
to=settings.AUTH_USER_MODEL,
103+
),
104+
),
79105
],
80106
options={
81107
"ordering": ["id"],
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Generated by Django makemigrations after removing Team.admins, Team.users, and Team.team_parents
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("users", "0017_alter_user_options_team"),
10+
]
11+
12+
operations = [
13+
migrations.RemoveField(
14+
model_name="team",
15+
name="admins",
16+
),
17+
migrations.RemoveField(
18+
model_name="team",
19+
name="team_parents",
20+
),
21+
migrations.RemoveField(
22+
model_name="team",
23+
name="users",
24+
),
25+
]

0 commit comments

Comments
 (0)