-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path0e975f452a77_step_template_table.py
More file actions
68 lines (60 loc) · 2.05 KB
/
0e975f452a77_step_template_table.py
File metadata and controls
68 lines (60 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
"""Step template table
Revision ID: 0e975f452a77
Revises: ad13850a7245
Create Date: 2025-05-26 13:17:19.196643
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "0e975f452a77"
down_revision = "ad13850a7245"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"step_templates",
sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False),
sa.Column("organization_id", postgresql.UUID(as_uuid=True), nullable=True),
sa.Column("name", sa.String(), nullable=True),
sa.Column("description", sa.String(), nullable=True),
sa.Column("created_at", sa.DateTime(), nullable=True),
sa.Column("created_by", postgresql.UUID(as_uuid=True), nullable=True),
sa.Column("config", sa.JSON(), nullable=True),
sa.ForeignKeyConstraint(["created_by"], ["user.id"], ondelete="SET NULL"),
sa.ForeignKeyConstraint(
["organization_id"], ["organization.id"], ondelete="CASCADE"
),
sa.PrimaryKeyConstraint("id"),
schema="cognition",
)
op.create_index(
op.f("ix_cognition_step_templates_created_by"),
"step_templates",
["created_by"],
unique=False,
schema="cognition",
)
op.create_index(
op.f("ix_cognition_step_templates_organization_id"),
"step_templates",
["organization_id"],
unique=False,
schema="cognition",
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(
op.f("ix_cognition_step_templates_organization_id"),
table_name="step_templates",
schema="cognition",
)
op.drop_index(
op.f("ix_cognition_step_templates_created_by"),
table_name="step_templates",
schema="cognition",
)
op.drop_table("step_templates", schema="cognition")
# ### end Alembic commands ###