Skip to content

Commit 861045c

Browse files
nndnnndn3github-actions[bot]
authored
fix: clean up migration (#437)
* fix: clean up migration * chore: Auto-fix pre-commit issues --------- Co-authored-by: nndn <guru.nandan.udupi@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 6df7b38 commit 861045c

File tree

1 file changed

+1
-83
lines changed

1 file changed

+1
-83
lines changed

app/alembic/versions/20250626135047_a7f9c1ec89e2_add_media_attachments_support.py

Lines changed: 1 addition & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
from alembic import op
1212
import sqlalchemy as sa
13-
from sqlalchemy.dialects import postgresql
1413

1514
# revision identifiers, used by Alembic.
1615
revision: str = "20250626135047_a7f9c1ec89e2"
@@ -20,14 +19,7 @@
2019

2120

2221
def upgrade() -> None:
23-
# ### commands auto generated by Alembic - please adjust! ###
24-
op.drop_index("ix_execution_logs_execution_id", table_name="execution_logs")
25-
op.drop_table("execution_logs")
26-
op.drop_index("ix_executions_workflow_id", table_name="executions")
27-
op.drop_table("executions")
28-
op.drop_table("alembic_version_workflows")
29-
op.drop_index("ix_workflows_created_by", table_name="workflows")
30-
op.drop_table("workflows")
22+
3123
# Add column as nullable first
3224
op.add_column("messages", sa.Column("has_attachments", sa.Boolean(), nullable=True))
3325
# Update all existing rows to set has_attachments=False
@@ -40,78 +32,4 @@ def upgrade() -> None:
4032

4133

4234
def downgrade() -> None:
43-
# ### commands auto generated by Alembic - please adjust! ###
4435
op.drop_column("messages", "has_attachments")
45-
op.create_table(
46-
"workflows",
47-
sa.Column("id", sa.VARCHAR(), autoincrement=False, nullable=False),
48-
sa.Column("title", sa.VARCHAR(), autoincrement=False, nullable=False),
49-
sa.Column("description", sa.VARCHAR(), autoincrement=False, nullable=False),
50-
sa.Column("created_by", sa.VARCHAR(), autoincrement=False, nullable=False),
51-
sa.Column(
52-
"created_at", postgresql.TIMESTAMP(), autoincrement=False, nullable=False
53-
),
54-
sa.Column(
55-
"updated_at", postgresql.TIMESTAMP(), autoincrement=False, nullable=False
56-
),
57-
sa.Column("repo_name", sa.VARCHAR(), autoincrement=False, nullable=False),
58-
sa.Column("branch", sa.VARCHAR(), autoincrement=False, nullable=False),
59-
sa.Column("agent_id", sa.VARCHAR(), autoincrement=False, nullable=False),
60-
sa.Column("hash", sa.VARCHAR(), autoincrement=False, nullable=False),
61-
sa.Column("task", sa.VARCHAR(), autoincrement=False, nullable=False),
62-
sa.Column("triggers_string", sa.VARCHAR(), autoincrement=False, nullable=False),
63-
sa.Column("is_paused", sa.BOOLEAN(), autoincrement=False, nullable=False),
64-
sa.PrimaryKeyConstraint("id", name="workflows_pkey"),
65-
sa.UniqueConstraint("hash", name="workflows_hash_key"),
66-
)
67-
op.create_index(
68-
"ix_workflows_created_by", "workflows", ["created_by"], unique=False
69-
)
70-
op.create_table(
71-
"alembic_version_workflows",
72-
sa.Column(
73-
"version_num", sa.VARCHAR(length=32), autoincrement=False, nullable=False
74-
),
75-
sa.PrimaryKeyConstraint("version_num", name="alembic_version_workflows_pkc"),
76-
)
77-
op.create_table(
78-
"executions",
79-
sa.Column("id", sa.VARCHAR(), autoincrement=False, nullable=False),
80-
sa.Column("workflow_id", sa.VARCHAR(), autoincrement=False, nullable=False),
81-
sa.Column("trigger", sa.VARCHAR(), autoincrement=False, nullable=False),
82-
sa.Column(
83-
"created_at", postgresql.TIMESTAMP(), autoincrement=False, nullable=False
84-
),
85-
sa.Column(
86-
"updated_at", postgresql.TIMESTAMP(), autoincrement=False, nullable=False
87-
),
88-
sa.PrimaryKeyConstraint("id", name="executions_pkey"),
89-
postgresql_ignore_search_path=False,
90-
)
91-
op.create_index(
92-
"ix_executions_workflow_id", "executions", ["workflow_id"], unique=False
93-
)
94-
op.create_table(
95-
"execution_logs",
96-
sa.Column("id", sa.INTEGER(), autoincrement=True, nullable=False),
97-
sa.Column("execution_id", sa.VARCHAR(), autoincrement=False, nullable=False),
98-
sa.Column("log", sa.TEXT(), autoincrement=False, nullable=False),
99-
sa.Column("status", sa.VARCHAR(), autoincrement=False, nullable=False),
100-
sa.Column(
101-
"created_at", postgresql.TIMESTAMP(), autoincrement=False, nullable=False
102-
),
103-
sa.ForeignKeyConstraint(
104-
["execution_id"],
105-
["executions.id"],
106-
name="execution_logs_execution_id_fkey",
107-
ondelete="CASCADE",
108-
),
109-
sa.PrimaryKeyConstraint("id", name="execution_logs_pkey"),
110-
)
111-
op.create_index(
112-
"ix_execution_logs_execution_id",
113-
"execution_logs",
114-
["execution_id"],
115-
unique=False,
116-
)
117-
# ### end Alembic commands ###

0 commit comments

Comments
 (0)