diff --git a/alembic/versions/0e975f452a77_step_template_table.py b/alembic/versions/0e975f452a77_step_template_table.py new file mode 100644 index 00000000..f14b5578 --- /dev/null +++ b/alembic/versions/0e975f452a77_step_template_table.py @@ -0,0 +1,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 ### diff --git a/submodules/model b/submodules/model index 142612ee..4cdfbd24 160000 --- a/submodules/model +++ b/submodules/model @@ -1 +1 @@ -Subproject commit 142612ee0e7071cbda19661db91727b3526cd6c7 +Subproject commit 4cdfbd240114f22ba493d9a552b812499e0c5298