From 545127966b078ee2000e02462a5d7e1c3a414d34 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Thu, 3 May 2018 11:50:53 +0100 Subject: [PATCH] Add letter organisation for CADW --- .../versions/0187_another_letter_org.py | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 migrations/versions/0187_another_letter_org.py diff --git a/migrations/versions/0187_another_letter_org.py b/migrations/versions/0187_another_letter_org.py new file mode 100644 index 000000000..5369cc727 --- /dev/null +++ b/migrations/versions/0187_another_letter_org.py @@ -0,0 +1,36 @@ +"""empty message + +Revision ID: 0187_another_letter_org +Revises: 0186_rename_is_active_columns +Create Date: 2017-06-29 12:44:16.815039 + +""" + +# revision identifiers, used by Alembic. +revision = '0187_another_letter_org' +down_revision = '0186_rename_is_active_columns' + +from alembic import op + + +NEW_ORGANISATIONS = [ + ('505', 'CADW'), +] + + +def upgrade(): + for numeric_id, name in NEW_ORGANISATIONS: + op.execute(""" + INSERT + INTO dvla_organisation + VALUES ('{}', '{}') + """.format(numeric_id, name)) + + +def downgrade(): + for numeric_id, _ in NEW_ORGANISATIONS: + op.execute(""" + DELETE + FROM dvla_organisation + WHERE id = '{}' + """.format(numeric_id))