Skip to content

Commit 06684b8

Browse files
authored
Templated steps (#306)
* Table creation * Submodule update
1 parent 7ca685b commit 06684b8

File tree

2 files changed

+69
-1
lines changed

2 files changed

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

0 commit comments

Comments
 (0)