We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1a2586f commit af417a2Copy full SHA for af417a2
alembic/versions/51d65f145c1f_create_prd.py
@@ -26,7 +26,7 @@ def upgrade() -> None:
26
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
27
sa.Column("hash", sa.String(length=255), nullable=False),
28
sa.Column("prd", sa.Text(), nullable=False),
29
- sa.Column("uploaded_by", sa.String(length=19), nullable=False),
+ sa.Column("uploaded_by", sa.String(length=255), nullable=False),
30
sa.ForeignKeyConstraint(
31
["uploaded_by"],
32
["users.id"],
@@ -36,7 +36,7 @@ def upgrade() -> None:
36
)
37
op.create_table(
38
"user_prd",
39
- sa.Column("user_id", sa.String(length=19), nullable=False),
+ sa.Column("user_id", sa.String(length=255), nullable=False),
40
sa.Column("device_hash", sa.String(length=255), nullable=False),
41
sa.ForeignKeyConstraint(["device_hash"], ["prds.hash"], ondelete="CASCADE"),
42
sa.ForeignKeyConstraint(["user_id"], ["users.id"], ondelete="CASCADE"),
alembic/versions/592b912adf54_init.py
@@ -102,6 +102,8 @@ def upgrade() -> None:
102
):
103
return
104
105
+ op.execute("SET FOREIGN_KEY_CHECKS=0;") # due to some added_by columns being null
106
+
107
# copy data from old tables to new tables
108
if migrate_existing_users:
109
op.execute(
@@ -135,6 +137,8 @@ def upgrade() -> None:
135
137
136
138
if migrate_existing_keys:
139
op.drop_table("keys__old")
140
141
+ op.execute("SET FOREIGN_KEY_CHECKS=1;")
142
# ### end Alembic commands ###
143
144
0 commit comments