File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
condition-api/migrations/versions Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ """set_is_active_for_existing_records
2+
3+ Revision ID: 0b5a70026d28
4+ Revises: a3f2b8c91d47
5+ Create Date: 2026-02-25
6+
7+ """
8+ from alembic import op
9+
10+
11+ # revision identifiers, used by Alembic.
12+ revision = '0b5a70026d28'
13+ down_revision = 'a3f2b8c91d47'
14+ branch_labels = None
15+ depends_on = None
16+
17+
18+ def upgrade ():
19+ # Set is_active = true for all existing records not created by cronjob
20+ op .execute ("""
21+ UPDATE condition.projects
22+ SET is_active = true
23+ WHERE created_by != 'cronjob'
24+ """ )
25+
26+ op .execute ("""
27+ UPDATE condition.documents
28+ SET is_active = true
29+ WHERE created_by != 'cronjob'
30+ """ )
31+
32+
33+ def downgrade ():
34+ # Revert all records back to is_active = false
35+ op .execute ("""
36+ UPDATE condition.projects
37+ SET is_active = false
38+ """ )
39+
40+ op .execute ("""
41+ UPDATE condition.documents
42+ SET is_active = false
43+ """ )
You can’t perform that action at this time.
0 commit comments