Skip to content

Commit 6765538

Browse files
committed
Update migration
1 parent cc5dd43 commit 6765538

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

alembic/versions/281723ba07be_add_cms_content_table.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,18 @@
1919

2020

2121
def upgrade():
22+
cms_types_enum = sa.Enum(
23+
"JOKE", "QUESTION", "FACT", "QUOTE", name="enum_cms_content_type"
24+
)
25+
2226
op.create_table(
2327
"cms_content",
2428
sa.Column(
2529
"id", sa.UUID(), server_default=sa.text("gen_random_uuid()"), nullable=False
2630
),
2731
sa.Column(
2832
"type",
29-
sa.Enum("JOKE", "QUESTION", "FACT", "QUOTE", name="enum_cms_content_type"),
33+
cms_types_enum,
3034
nullable=False,
3135
),
3236
sa.Column("content", postgresql.JSONB(astext_type=sa.Text()), nullable=True),
@@ -56,3 +60,7 @@ def downgrade():
5660
op.drop_index(op.f("ix_cms_content_type"), table_name="cms_content")
5761
op.drop_index(op.f("ix_cms_content_id"), table_name="cms_content")
5862
op.drop_table("cms_content")
63+
64+
op.execute("DROP TYPE enum_cms_content_type")
65+
genresource = sa.Enum(name="enum_cms_content_type")
66+
genresource.drop(op.get_bind(), checkfirst=True)

0 commit comments

Comments
 (0)