Skip to content

Commit

Permalink
Insert low, med, high default categories during migration
Browse files Browse the repository at this point in the history
  • Loading branch information
whabanks committed Jun 13, 2024
1 parent 70334b0 commit 0430b4b
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions migrations/versions/0454_add_template_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
revision = "0454_add_template_categories"
down_revision = "0452_set_pgaudit_config"

# TODO: Add these to the config instead
DEFAULT_LOW = "0dda24c2-982a-4f44-9749-0e38b2607e89"
DEFAULT_MEDIUM = "f75d6706-21b7-437e-b93a-2c0ab771e28e"
DEFAULT_HIGH = "c4f87d7c-a55b-4c0f-91fe-e56c65bb1871"

def upgrade():
op.create_table(
Expand Down Expand Up @@ -52,12 +56,22 @@ def upgrade():
)
op.create_foreign_key("fk_template_template_categories", "templates", "template_categories", ["template_category_id"], ["id"])

# Insert the generic Low priority (bulk) category
# op.execute("""
# INSERT INTO template_category (id, name_en, name_fr, sms_process_type, email_process_type, hidden)
# VALUES ('00000000-0000-0000-0000-000000000000', 'Low Category (Bulk)', 'Catégorie Basse (En Vrac)', true
# """
# )
# Insert the generic low, medium, and high categories
op.execute(f"""
INSERT INTO template_category (id, name_en, name_fr, sms_process_type, email_process_type, hidden)
VALUES ({DEFAULT_LOW}, 'Low Category (Bulk)', 'Catégorie Basse (En Vrac)', true
"""
)
op.execute(f"""
INSERT INTO template_category (id, name_en, name_fr, sms_process_type, email_process_type, hidden)
VALUES ({DEFAULT_MEDIUM}, 'Medium Category (Normal)', 'Catégorie Moyenne (Normale)', true
"""
)
op.execute(f"""
INSERT INTO template_category (id, name_en, name_fr, sms_process_type, email_process_type, hidden)
VALUES ({DEFAULT_HIGH}, 'High Category (Priority)', 'Catégorie Haute (Priorité)', true
"""
)


def downgrade():
Expand Down

0 comments on commit 0430b4b

Please sign in to comment.