File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed
condition-api/migrations/versions Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Original file line number Diff line number Diff line change 1616
1717
1818def upgrade ():
19- # Set is_active = true for documents that belong to a project
20- # which has at least one document in the documents table
19+ # Set is_active = true for all existing records not created by cronjob
2120 op .execute ("""
22- UPDATE condition.documents
21+ UPDATE condition.projects
2322 SET is_active = true
24- WHERE project_id IN (
25- SELECT DISTINCT project_id
26- FROM condition.documents
27- )
23+ WHERE created_by != 'cronjob'
2824 """ )
2925
30- # Set is_active = true for projects that have at least one
31- # related document in the documents table
3226 op .execute ("""
33- UPDATE condition.projects
27+ UPDATE condition.documents
3428 SET is_active = true
35- WHERE project_id IN (
36- SELECT DISTINCT project_id
37- FROM condition.documents
38- )
29+ WHERE created_by != 'cronjob'
3930 """ )
4031
4132
You can’t perform that action at this time.
0 commit comments