Skip to content

TRACK-307, add new ministries #2492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 6, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',1)")
op.execute("INSERT INTO ministries (name,abbreviation,sort_order) values ('Forests','FOR',2)")
op.execute("INSERT INTO ministries (name,abbreviation,sort_order) values ('Jobs, Economic Development and Innovation','JEDI',3)")
op.execute("INSERT INTO ministries (name,abbreviation,sort_order) values ('Tourism, Arts, Culture and Sport','TACS',4)")
op.execute("INSERT INTO ministries (name,abbreviation,sort_order) values ('Housing and Municipal Affairs','HOUS',5)")
op.execute("INSERT INTO ministries (name,abbreviation,sort_order) values ('Water, Land and Resource Stewardship','WLRS',6)")
op.execute("INSERT INTO ministries (name,abbreviation,sort_order) values ('Transportation and Transit','MOTI',7)")


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'")