Skip to content

Commit 058619e

Browse files
authored
Merge pull request #81 from IATI/ca/hotfix-migration
Fix Alembic migration script to add client_id column to tooldbmodel
2 parents ff1a342 + 9ca6f9b commit 058619e

1 file changed

Lines changed: 1 addition & 38 deletions

File tree

alembic/versions/b2c6d1170383_add_client_id_to_tooldbmodel.py

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import sqlalchemy as sa
1212
import sqlmodel
1313
from alembic import op
14-
from sqlalchemy.dialects import postgresql
1514

1615
# revision identifiers, used by Alembic.
1716
revision: str = "b2c6d1170383"
@@ -22,45 +21,9 @@
2221

2322
def upgrade() -> None:
2423
"""Upgrade schema."""
25-
# ### commands auto generated by Alembic - please adjust! ###
26-
op.alter_column(
27-
"finegrainedauthorisationdbmodel",
28-
"role",
29-
existing_type=postgresql.ENUM(
30-
"CONTRIBUTOR", "EDITOR", "PROVIDER_ADMIN", "ADMIN", "CONTRIBUTOR_PENDING", name="role"
31-
),
32-
type_=sa.Enum(
33-
"CONTRIBUTOR",
34-
"EDITOR",
35-
"PROVIDER_ADMIN",
36-
"ADMIN",
37-
"SUPER_ADMIN",
38-
"CONTRIBUTOR_PENDING",
39-
name="finegrainedauthorisationrole",
40-
),
41-
existing_nullable=False,
42-
)
43-
op.add_column("tooldbmodel", sa.Column("client_id", sqlmodel.sql.sqltypes.AutoString(), nullable=False))
44-
# ### end Alembic commands ###
24+
op.add_column("tooldbmodel", sa.Column("client_id", sqlmodel.sql.sqltypes.AutoString(), nullable=True))
4525

4626

4727
def downgrade() -> None:
4828
"""Downgrade schema."""
49-
# ### commands auto generated by Alembic - please adjust! ###
5029
op.drop_column("tooldbmodel", "client_id")
51-
op.alter_column(
52-
"finegrainedauthorisationdbmodel",
53-
"role",
54-
existing_type=sa.Enum(
55-
"CONTRIBUTOR",
56-
"EDITOR",
57-
"PROVIDER_ADMIN",
58-
"ADMIN",
59-
"SUPER_ADMIN",
60-
"CONTRIBUTOR_PENDING",
61-
name="finegrainedauthorisationrole",
62-
),
63-
type_=postgresql.ENUM("CONTRIBUTOR", "EDITOR", "PROVIDER_ADMIN", "ADMIN", "CONTRIBUTOR_PENDING", name="role"),
64-
existing_nullable=False,
65-
)
66-
# ### end Alembic commands ###

0 commit comments

Comments
 (0)