more files and remove add_letter_org migrations

This commit is contained in:
Kenneth Kehl
2023-07-17 10:26:23 -07:00
parent d872bfc5ee
commit 56ea2464e4
40 changed files with 54 additions and 806 deletions

View File

@@ -1,25 +0,0 @@
"""empty message
Revision ID: 0116_another_letter_org
Revises: 0115_add_inbound_numbers
Create Date: 2017-06-29 12:44:16.815039
"""
# revision identifiers, used by Alembic.
revision = '0116_another_letter_org'
down_revision = '0115_add_inbound_numbers'
from alembic import op
def upgrade():
op.execute("""
INSERT INTO dvla_organisation VALUES
('005', 'Companies House')
""")
def downgrade():
# data migration, no downloads
pass

View File

@@ -1,7 +1,7 @@
"""empty message
Revision ID: 0117_international_sms_notify
Revises: 0116_another_letter_org
Revises: 0115_add_inbound_numbers
Create Date: 2017-08-29 14:09:41.042061
"""
@@ -10,7 +10,7 @@ Create Date: 2017-08-29 14:09:41.042061
from sqlalchemy import text
revision = '0117_international_sms_notify'
down_revision = '0116_another_letter_org'
down_revision = '0115_add_inbound_numbers'
from alembic import op
from datetime import datetime

View File

@@ -8,6 +8,9 @@ Create Date: 2017-11-10 21:42:59.715203
from datetime import datetime
from alembic import op
import uuid
from sqlalchemy import text
from app.dao.date_util import get_current_calendar_year_start_year
@@ -21,20 +24,28 @@ def upgrade():
# Step 1: update the column free_sms_fragment_limit in service table if it is empty
update_service_table = """
UPDATE services SET free_sms_fragment_limit = {} where free_sms_fragment_limit is null
""".format(default_limit)
op.execute(update_service_table)
UPDATE services SET free_sms_fragment_limit = :default_limit where free_sms_fragment_limit is null
"""
input_params = {
"default_limit": default_limit
}
conn = op.get_bind()
conn.execute(text(update_service_table), input_params)
# Step 2: insert at least one row for every service in current year if none exist for that service
input_params = {
"current_year": current_year,
"default_limit": default_limit,
"time_now": datetime.utcnow()
}
insert_row_if_not_exist = """
INSERT INTO annual_billing
(id, service_id, financial_year_start, free_sms_fragment_limit, created_at, updated_at)
SELECT uuid_in(md5(random()::text)::cstring), id, {}, {}, '{}', '{}'
SELECT uuid_in(md5(random()::text)::cstring), id, :current_year, :default_limit, :time_now, :time_now
FROM services WHERE id NOT IN
(select service_id from annual_billing)
""".format(current_year, default_limit, datetime.utcnow(), datetime.utcnow())
op.execute(insert_row_if_not_exist)
"""
conn.execute(text(insert_row_if_not_exist), input_params)
# Step 3: copy the free_sms_fragment_limit data from the services table across to annual_billing table.
update_sms_allowance = """

View File

@@ -1,41 +0,0 @@
"""empty message
Revision ID: 0150_another_letter_org
Revises: 0149_add_crown_to_services
Create Date: 2017-06-29 12:44:16.815039
"""
# revision identifiers, used by Alembic.
from sqlalchemy import text
revision = '0150_another_letter_org'
down_revision = '0149_add_crown_to_services'
from alembic import op
NEW_ORGANISATIONS = [
('006', 'DWP (Welsh)'),
('007', 'Department for Communities'),
('008', 'Marine Management Organisation'),
]
def upgrade():
conn = op.get_bind()
for numeric_id, name in NEW_ORGANISATIONS:
input_params = {
"numeric_id": numeric_id,
"name": name
}
conn.execute(text("INSERT INTO dvla_organisation VALUES (:numeric_id, :name)"), input_params)
def downgrade():
conn = op.get_bind()
for numeric_id, _ in NEW_ORGANISATIONS:
input_params = {
"numeric_id": numeric_id
}
conn.execute(text("DELETE FROM dvla_organisation WHERE id = :numeric_id"), input_params)

View File

@@ -1,7 +1,7 @@
"""
Revision ID: 0151_refactor_letter_rates
Revises: 0150_another_letter_org
Revises: 0149_add_crown_to_services
Create Date: 2017-12-05 10:24:41.232128
"""
@@ -13,7 +13,7 @@ import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0151_refactor_letter_rates'
down_revision = '0150_another_letter_org'
down_revision = '0149_add_crown_to_services'
def upgrade():

View File

@@ -1,40 +0,0 @@
"""empty message
Revision ID: 0160_another_letter_org
Revises: 0159_add_historical_redact
Create Date: 2017-06-29 12:44:16.815039
"""
# revision identifiers, used by Alembic.
from sqlalchemy import text
revision = '0160_another_letter_org'
down_revision = '0159_add_historical_redact'
from alembic import op
NEW_ORGANISATIONS = [
('501', 'Environment Agency (PDF letters ONLY)'),
]
def upgrade():
conn = op.get_bind()
for numeric_id, name in NEW_ORGANISATIONS:
input_params = {
"numeric_id": numeric_id,
"name": name
}
conn.execute(text("INSERT INTO dvla_organisation VALUES (:numeric_id, :name)"), input_params)
def downgrade():
conn = op.get_bind()
for numeric_id, _ in NEW_ORGANISATIONS:
input_params = {
"numeric_id": numeric_id
}
conn.execute(text("DELETE FROM dvla_organisation WHERE id = :numeric_id"), input_params)

View File

@@ -1,7 +1,7 @@
"""
Revision ID: 0161_email_branding
Revises: 0160_another_letter_org
Revises: 0159_add_historical_redact
Create Date: 2018-01-30 15:35:12.016574
"""
@@ -10,7 +10,7 @@ import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0161_email_branding'
down_revision = '0160_another_letter_org'
down_revision = '0159_add_historical_redact'
def upgrade():

View File

@@ -1,37 +0,0 @@
"""empty message
Revision ID: 0165_another_letter_org
Revises: 0164_add_organisation_to_service
Create Date: 2017-06-29 12:44:16.815039
"""
# revision identifiers, used by Alembic.
revision = '0165_another_letter_org'
down_revision = '0164_add_organisation_to_service'
from alembic import op
NEW_ORGANISATIONS = [
('502', 'Welsh Revenue Authority'),
('503', 'East Riding of Yorkshire Council'),
]
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))

View File

@@ -1,7 +1,7 @@
"""
Revision ID: 0166_add_org_user_stuff
Revises: 0165_another_letter_org
Revises: 0164_add_organisation_to_service
Create Date: 2018-02-14 17:25:11.747996
"""
@@ -10,7 +10,7 @@ import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0166_add_org_user_stuff'
down_revision = '0165_another_letter_org'
down_revision = '0164_add_organisation_to_service'
def upgrade():

View File

@@ -1,39 +0,0 @@
"""empty message
Revision ID: 0180_another_letter_org
Revises: 0179_billing_primary_const
Create Date: 2017-06-29 12:44:16.815039
"""
# revision identifiers, used by Alembic.
from sqlalchemy import text
revision = '0180_another_letter_org'
down_revision = '0179_billing_primary_const'
from alembic import op
NEW_ORGANISATIONS = [
('504', 'Rother District Council'),
]
def upgrade():
conn = op.get_bind()
for numeric_id, name in NEW_ORGANISATIONS:
input_params = {
"numeric_id": numeric_id,
"name": name
}
conn.execute(text("INSERT INTO dvla_organisation VALUES (:numeric_id, :name)"), input_params)
def downgrade():
conn = op.get_bind()
for numeric_id, _ in NEW_ORGANISATIONS:
input_params = {
"numeric_id": numeric_id
}
conn.execute(text("DELETE FROM dvla_organisation WHERE id = :numeric_id"), input_params)

View File

@@ -1,7 +1,7 @@
"""
Revision ID: 0181_billing_primary_key
Revises: 0180_another_letter_org
Revises: 0179_billing_primary_const
Create Date: 2018-03-21 13:41:26.203712
"""
@@ -10,7 +10,7 @@ import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0181_billing_primary_key'
down_revision = '0180_another_letter_org'
down_revision = '0179_billing_primary_const'
def upgrade():

View File

@@ -1,36 +0,0 @@
"""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))

View File

@@ -1,7 +1,7 @@
"""
Revision ID: 0188_add_ft_notification_status
Revises: 0187_another_letter_org
Revises: 0186_rename_is_active_columns
Create Date: 2018-05-03 10:10:41.824981
"""
@@ -10,7 +10,7 @@ import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0188_add_ft_notification_status'
down_revision = '0187_another_letter_org'
down_revision = '0186_rename_is_active_columns'
def upgrade():

View File

@@ -1,37 +0,0 @@
"""empty message
Revision ID: 0190_another_letter_org
Revises: 0189_ft_billing_data_type
Create Date: 2017-06-29 12:44:16.815039
"""
# revision identifiers, used by Alembic.
revision = '0190_another_letter_org'
down_revision = '0189_ft_billing_data_type'
from alembic import op
NEW_ORGANISATIONS = [
('506', 'Tyne and Wear Fire and Rescue Service'),
('507', 'Thames Valley Police'),
]
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))

View File

@@ -1,14 +1,14 @@
"""
Revision ID: 0191_ft_billing_pkey
Revises: 0190_another_letter_org
Revises: 0189_ft_billing_data
Create Date: 2018-05-21 14:24:27.229511
"""
from alembic import op
revision = '0191_ft_billing_pkey'
down_revision = '0190_another_letter_org'
down_revision = '0189_ft_billing_data_type'
def upgrade():

View File

@@ -1,36 +0,0 @@
"""empty message
Revision ID: 0199_another_letter_org
Revises: 0198_add_caseworking_permission
Create Date: 2017-06-29 12:44:16.815039
"""
# revision identifiers, used by Alembic.
revision = '0199_another_letter_org'
down_revision = '0198_add_caseworking_permission'
from alembic import op
NEW_ORGANISATIONS = [
('009', 'HM Passport Office'),
]
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))

View File

@@ -1,36 +0,0 @@
"""empty message
Revision ID: 0200_another_letter_org
Revises: 0199_another_letter_org
Create Date: 2017-06-29 12:44:16.815039
"""
# revision identifiers, used by Alembic.
revision = '0200_another_letter_org'
down_revision = '0199_another_letter_org'
from alembic import op
NEW_ORGANISATIONS = [
('508', 'Ofgem'),
]
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))

View File

@@ -1,36 +0,0 @@
"""empty message
Revision ID: 0201_another_letter_org
Revises: 0200_another_letter_org
Create Date: 2017-06-29 12:44:16.815039
"""
# revision identifiers, used by Alembic.
revision = '0201_another_letter_org'
down_revision = '0200_another_letter_org'
from alembic import op
NEW_ORGANISATIONS = [
('509', 'Hackney Council'),
]
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))

View File

@@ -1,13 +1,13 @@
"""empty message
Revision ID: 0202_new_letter_pricing
Revises: 0201_another_letter_org
Revises: 0198_add_caseworking_permission
Create Date: 2017-07-09 12:44:16.815039
"""
revision = '0202_new_letter_pricing'
down_revision = '0201_another_letter_org'
down_revision = '0198_add_caseworking_permission'
import uuid
from datetime import datetime

View File

@@ -1,39 +0,0 @@
"""empty message
Revision ID: 0214_another_letter_org
Revises: 0213_brand_colour_domain_
"""
# revision identifiers, used by Alembic.
from sqlalchemy import text
revision = '0214_another_letter_org'
down_revision = '0213_brand_colour_domain'
from alembic import op
NEW_ORGANISATIONS = [
('510', 'Pension Wise'),
]
def upgrade():
conn = op.get_bind()
for numeric_id, name in NEW_ORGANISATIONS:
input_params = {
"numeric_id": numeric_id,
"name": name
}
conn.execute(text("INSERT INTO dvla_organisation VALUES (:numeric_id, :name)"), input_params)
def downgrade():
conn = op.get_bind()
for numeric_id, _ in NEW_ORGANISATIONS:
input_params = {
"numeric_id": numeric_id
}
conn.execute(text("DELETE FROM dvla_organisation WHERE id = :numeric_id"), input_params)

View File

@@ -1,7 +1,7 @@
"""
Revision ID: 0215_email_brand_type
Revises: 0214_another_letter_org
Revises: 0213_brand_colour_domain_
Create Date: 2018-08-23 11:48:00.800968
"""
@@ -9,7 +9,7 @@ from alembic import op
import sqlalchemy as sa
revision = '0215_email_brand_type'
down_revision = '0214_another_letter_org'
down_revision = '0213_brand_colour_domain'
def upgrade():

View File

@@ -1,35 +0,0 @@
"""empty message
Revision ID: 0218_another_letter_org
Revises: 0217_default_email_branding
"""
# revision identifiers, used by Alembic.
revision = '0218_another_letter_org'
down_revision = '0217_default_email_branding'
from alembic import op
NEW_ORGANISATIONS = [
('511', 'NHS'),
]
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))

View File

@@ -1,13 +1,13 @@
"""
Revision ID: 0219_default_email_branding
Revises: 0218_another_letter_org
Revises: 0217_default_email_branding
Create Date: 2018-08-24 13:36:49.346156
"""
from alembic import op
from app.models import BRANDING_ORG
revision = '0219_default_email_branding'
down_revision = '0218_another_letter_org'
down_revision = '0217_default_email_branding'
def upgrade():

View File

@@ -1,36 +0,0 @@
"""empty message
Revision ID: 0225_another_letter_org
Revises: 0224_returned_letter_status
"""
# revision identifiers, used by Alembic.
revision = '0225_another_letter_org'
down_revision = '0224_returned_letter_status'
from alembic import op
NEW_ORGANISATIONS = [
('512', 'Vale of Glamorgan'),
('513', 'Rother and Wealden'),
]
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))

View File

@@ -1,7 +1,7 @@
"""
Revision ID: 0226_service_postage
Revises: 0225_another_letter_org
Revises: 0224_returned_letter_status
Create Date: 2018-09-13 16:23:59.168877
"""
@@ -10,7 +10,7 @@ import sqlalchemy as sa
revision = '0226_service_postage'
down_revision = '0225_another_letter_org'
down_revision = '0224_returned_letter_status'
def upgrade():

View File

@@ -1,35 +0,0 @@
"""empty message
Revision ID: 0236_another_letter_org
Revises: 0235_add_postage_to_pk
"""
# revision identifiers, used by Alembic.
revision = '0236_another_letter_org'
down_revision = '0235_add_postage_to_pk'
from alembic import op
NEW_ORGANISATIONS = [
('514', 'Brighton and Hove city council'),
]
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))

View File

@@ -1,7 +1,7 @@
"""
Revision ID: 0237_add_filename_to_dvla_org
Revises: 0236_another_letter_org
Revises: 0235_add_postage_to_pk
Create Date: 2018-09-28 15:39:21.115358
"""
@@ -11,7 +11,7 @@ from sqlalchemy.sql import text
revision = '0237_add_filename_to_dvla_org'
down_revision = '0236_another_letter_org'
down_revision = '0235_add_postage_to_pk'
LOGOS = {

View File

@@ -1,35 +0,0 @@
"""empty message
Revision ID: 0241_another_letter_org
Revises: 0240_dvla_org_non_nullable
"""
# revision identifiers, used by Alembic.
revision = '0241_another_letter_org'
down_revision = '0240_dvla_org_non_nullable'
from alembic import op
NEW_ORGANISATIONS = [
('515', 'ACAS', 'acas'),
]
def upgrade():
for numeric_id, name, filename in NEW_ORGANISATIONS:
op.execute("""
INSERT
INTO dvla_organisation
VALUES ('{}', '{}', '{}')
""".format(numeric_id, name, filename))
def downgrade():
for numeric_id, _, _ in NEW_ORGANISATIONS:
op.execute("""
DELETE
FROM dvla_organisation
WHERE id = '{}'
""".format(numeric_id))

View File

@@ -1,7 +1,7 @@
"""
Revision ID: 0242_template_folders
Revises: 0241_another_letter_org
Revises: 0240_dvla_org_non_nullable
Create Date: 2018-10-26 16:00:40.173840
"""
@@ -10,7 +10,7 @@ import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0242_template_folders'
down_revision = '0241_another_letter_org'
down_revision = '0240_dvla_org_non_nullable'
def upgrade():

View File

@@ -1,36 +0,0 @@
"""empty message
Revision ID: 0243_another_letter_org
Revises: 0242_template_folders
"""
# revision identifiers, used by Alembic.
revision = '0243_another_letter_org'
down_revision = '0242_template_folders'
from alembic import op
NEW_ORGANISATIONS = [
('516', 'Worcestershire County Council', 'worcestershire'),
('517', 'Buckinghamshire County Council', 'buckinghamshire'),
]
def upgrade():
for numeric_id, name, filename in NEW_ORGANISATIONS:
op.execute("""
INSERT
INTO dvla_organisation
VALUES ('{}', '{}', '{}')
""".format(numeric_id, name, filename))
def downgrade():
for numeric_id, _, _ in NEW_ORGANISATIONS:
op.execute("""
DELETE
FROM dvla_organisation
WHERE id = '{}'
""".format(numeric_id))

View File

@@ -1,36 +0,0 @@
"""empty message
Revision ID: 0244_another_letter_org
Revises: 0243_another_letter_org
"""
# revision identifiers, used by Alembic.
revision = '0244_another_letter_org'
down_revision = '0243_another_letter_org'
from alembic import op
NEW_ORGANISATIONS = [
('518', 'Bournemouth Borough Council', 'bournemouth'),
('519', 'Hampshire County Council', 'hants'),
]
def upgrade():
for numeric_id, name, filename in NEW_ORGANISATIONS:
op.execute("""
INSERT
INTO dvla_organisation
VALUES ('{}', '{}', '{}')
""".format(numeric_id, name, filename))
def downgrade():
for numeric_id, _, _ in NEW_ORGANISATIONS:
op.execute("""
DELETE
FROM dvla_organisation
WHERE id = '{}'
""".format(numeric_id))

View File

@@ -1,7 +1,7 @@
"""
Revision ID: 0245_archived_flag_jobs
Revises: 0244_another_letter_org
Revises: 0242_template_folders
Create Date: 2018-11-22 16:32:01.105803
"""
@@ -10,7 +10,7 @@ import sqlalchemy as sa
revision = '0245_archived_flag_jobs'
down_revision = '0244_another_letter_org'
down_revision = '0242_template_folders'
def upgrade():

View File

@@ -1,35 +0,0 @@
"""empty message
Revision ID: 0247_another_letter_org
Revises: 0246_notifications_index
"""
# revision identifiers, used by Alembic.
revision = '0247_another_letter_org'
down_revision = '0246_notifications_index'
from alembic import op
NEW_ORGANISATIONS = [
('520', 'Neath Port Talbot Council', 'npt'),
]
def upgrade():
for numeric_id, name, filename in NEW_ORGANISATIONS:
op.execute("""
INSERT
INTO dvla_organisation
VALUES ('{}', '{}', '{}')
""".format(numeric_id, name, filename))
def downgrade():
for numeric_id, _, _ in NEW_ORGANISATIONS:
op.execute("""
DELETE
FROM dvla_organisation
WHERE id = '{}'
""".format(numeric_id))

View File

@@ -1,7 +1,7 @@
"""
Revision ID: 0248_enable_choose_postage
Revises: 0247_another_letter_org
Revises: 0246_notifications_index
Create Date: 2018-12-14 12:09:31.375634
"""
@@ -10,7 +10,7 @@ import sqlalchemy as sa
revision = '0248_enable_choose_postage'
down_revision = '0247_another_letter_org'
down_revision = '0246_notifications_index'
def upgrade():

View File

@@ -1,35 +0,0 @@
"""empty message
Revision ID: 0249_another_letter_org
Revises: 0248_enable_choose_postage
"""
# revision identifiers, used by Alembic.
revision = '0249_another_letter_org'
down_revision = '0248_enable_choose_postage'
from alembic import op
NEW_ORGANISATIONS = [
('521', 'North Somerset Council', 'north-somerset'),
]
def upgrade():
for numeric_id, name, filename in NEW_ORGANISATIONS:
op.execute("""
INSERT
INTO dvla_organisation
VALUES ('{}', '{}', '{}')
""".format(numeric_id, name, filename))
def downgrade():
for numeric_id, _, _ in NEW_ORGANISATIONS:
op.execute("""
DELETE
FROM dvla_organisation
WHERE id = '{}'
""".format(numeric_id))

View File

@@ -1,7 +1,7 @@
"""
Revision ID: 0250_drop_stats_template_table
Revises: 0249_another_letter_org
Revises: 0248_enable_choose_postage
Create Date: 2019-01-15 16:47:08.049369
"""
@@ -10,7 +10,7 @@ import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0250_drop_stats_template_table'
down_revision = '0249_another_letter_org'
down_revision = '0248_enable_choose_postage'
def upgrade():

View File

@@ -1,39 +0,0 @@
"""empty message
Revision ID: 0251_another_letter_org
Revises: 0250_drop_stats_template_table
"""
# revision identifiers, used by Alembic.
revision = '0251_another_letter_org'
down_revision = '0250_drop_stats_template_table'
from alembic import op
NEW_ORGANISATIONS = [
('522', 'Anglesey Council', 'anglesey'),
('523', 'Angus Council', 'angus'),
('524', 'Cheshire East Council', 'cheshire-east'),
('525', 'Newham Council', 'newham'),
('526', 'Warwickshire Council', 'warwickshire'),
]
def upgrade():
for numeric_id, name, filename in NEW_ORGANISATIONS:
op.execute("""
INSERT
INTO dvla_organisation
VALUES ('{}', '{}', '{}')
""".format(numeric_id, name, filename))
def downgrade():
for numeric_id, _, _ in NEW_ORGANISATIONS:
op.execute("""
DELETE
FROM dvla_organisation
WHERE id = '{}'
""".format(numeric_id))

View File

@@ -1,7 +1,7 @@
"""
Revision ID: 0252_letter_branding_table
Revises: 0251_another_letter_org
Revises: 0250_drop_stats_template_table
Create Date: 2019-01-17 15:45:33.242955
"""
@@ -11,7 +11,7 @@ import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0252_letter_branding_table'
down_revision = '0251_another_letter_org'
down_revision = '0250_drop_stats_template_table'
def upgrade():

View File

@@ -1,39 +0,0 @@
"""empty message
Revision ID: 0255_another_letter_org
Revises: 0254_folders_for_all
"""
# revision identifiers, used by Alembic.
revision = '0255_another_letter_org'
down_revision = '0254_folders_for_all'
from alembic import op
NEW_ORGANISATIONS = [
('010', 'Disclosure and Barring Service', 'dbs'),
('527', 'Natural Resources Wales', 'natural-resources-wales'),
('528', 'North Yorkshire Council', 'north-yorkshire'),
('529', 'Redbridge Council', 'redbridge'),
('530', 'Wigan Council', 'wigan'),
]
def upgrade():
for numeric_id, name, filename in NEW_ORGANISATIONS:
op.execute("""
INSERT
INTO dvla_organisation
VALUES ('{}', '{}', '{}')
""".format(numeric_id, name, filename))
def downgrade():
for numeric_id, _, _ in NEW_ORGANISATIONS:
op.execute("""
DELETE
FROM dvla_organisation
WHERE id = '{}'
""".format(numeric_id))

View File

@@ -1,7 +1,7 @@
"""
Revision ID: 0256_set_postage_tmplt_hstr
Revises: 0255_another_letter_org
Revises: 0254_folders_for_all
Create Date: 2019-02-05 14:51:30.808067
"""
@@ -10,7 +10,7 @@ import sqlalchemy as sa
revision = '0256_set_postage_tmplt_hstr'
down_revision = '0255_another_letter_org'
down_revision = '0254_folders_for_all'
def upgrade():