10
10
11
11
from alembic import op
12
12
import sqlalchemy as sa
13
- from sqlalchemy .dialects import postgresql
14
13
15
14
# revision identifiers, used by Alembic.
16
15
revision : str = "20250626135047_a7f9c1ec89e2"
20
19
21
20
22
21
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
+
31
23
# Add column as nullable first
32
24
op .add_column ("messages" , sa .Column ("has_attachments" , sa .Boolean (), nullable = True ))
33
25
# Update all existing rows to set has_attachments=False
@@ -40,78 +32,4 @@ def upgrade() -> None:
40
32
41
33
42
34
def downgrade () -> None :
43
- # ### commands auto generated by Alembic - please adjust! ###
44
35
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