Skip to content

Commit 6782261

Browse files
fix: update migration
1 parent 9cc78c1 commit 6782261

File tree

2 files changed

+44
-65
lines changed

2 files changed

+44
-65
lines changed

migrations/versions/latest-greencode.py

Lines changed: 0 additions & 65 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"""greencode
2+
3+
Create Date: 2024-05-19 11:22:07.692889
4+
"""
5+
6+
from collections.abc import Sequence
7+
8+
import sqlalchemy as sa
9+
from alembic import op
10+
11+
# revision identifiers, used by Alembic.
12+
revision: str = "aac7a97d3dab"
13+
down_revision: str | None = "fce1716123e2"
14+
branch_labels: str | Sequence[str] | None = None
15+
depends_on: str | Sequence[str] | None = None
16+
17+
18+
def upgrade() -> None:
19+
# ### commands auto generated by Alembic - please adjust! ###
20+
op.create_table(
21+
"greencode_items",
22+
sa.Column("id", sa.Uuid(), nullable=False),
23+
sa.Column("qr_code_content", sa.String(), nullable=False),
24+
sa.Column("title", sa.String(), nullable=False),
25+
sa.Column("content", sa.String(), nullable=False),
26+
sa.PrimaryKeyConstraint("id"),
27+
sa.UniqueConstraint("qr_code_content"),
28+
)
29+
op.create_table(
30+
"greencode_memberships",
31+
sa.Column("item_id", sa.Uuid(), nullable=False),
32+
sa.Column("user_id", sa.String(), nullable=False),
33+
sa.ForeignKeyConstraint(["item_id"], ["greencode_items.id"]),
34+
sa.ForeignKeyConstraint(["user_id"], ["core_user.id"]),
35+
sa.PrimaryKeyConstraint("item_id", "user_id"),
36+
)
37+
# ### end Alembic commands ###
38+
39+
40+
def downgrade() -> None:
41+
# ### commands auto generated by Alembic - please adjust! ###
42+
op.drop_table("greencode_memberships")
43+
op.drop_table("greencode_items")
44+
# ### end Alembic commands ###

0 commit comments

Comments
 (0)