-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TRACK-307, add new ministries (#2492)
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
epictrack-api/migrations/versions/eccbb8b96011_add_new_ministries.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""add new ministries | ||
Revision ID: eccbb8b96011 | ||
Revises: 09fb62ec79e9 | ||
Create Date: 2025-01-02 15:19:17.743999 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'eccbb8b96011' | ||
down_revision = '09fb62ec79e9' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.execute("UPDATE ministries SET sort_order = sort_order + 7 WHERE name != 'Not Applicable'") | ||
op.execute("INSERT INTO ministries (name,abbreviation,sort_order) values ('Mining and Critical Minerals','MCM',2)") | ||
op.execute("INSERT INTO ministries (name,abbreviation,sort_order) values ('Forests','FOR',3)") | ||
op.execute("INSERT INTO ministries (name,abbreviation,sort_order) values ('Jobs, Economic Development and Innovation','JEDI',4)") | ||
op.execute("INSERT INTO ministries (name,abbreviation,sort_order) values ('Tourism, Arts, Culture and Sport','TACS',5)") | ||
op.execute("INSERT INTO ministries (name,abbreviation,sort_order) values ('Housing and Municipal Affairs','HOUS',6)") | ||
op.execute("INSERT INTO ministries (name,abbreviation,sort_order) values ('Water, Land and Resource Stewardship','WLRS',7)") | ||
op.execute("INSERT INTO ministries (name,abbreviation,sort_order) values ('Transportation and Transit','MOTI',8)") | ||
|
||
|
||
def downgrade(): | ||
op.execute("DELETE FROM ministries WHERE name IN ('Mining and Critical Minerals', 'Forests', 'Jobs, Economic Development and Innovation', 'Tourism, Arts, Culture and Sport', 'Housing and Municipal Affairs', 'Water, Land and Resource Stewardship', 'Transportation and Transit')") | ||
op.execute("UPDATE ministries SET sort_order = sort_order - 7 WHERE name != 'Not Applicable'") |