Skip to content

Commit e0b6155

Browse files
Merge pull request #152 from VineetBala-AOT/main
update active projects and documents
2 parents 481e229 + e802a5b commit e0b6155

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
""")

0 commit comments

Comments
 (0)