mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-21 16:01:15 -05:00
more files
This commit is contained in:
@@ -7,6 +7,8 @@ Create Date: 2016-06-13 15:15:34.035984
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
|
from sqlalchemy import text
|
||||||
|
|
||||||
revision = '0029_fix_email_from'
|
revision = '0029_fix_email_from'
|
||||||
down_revision = '0028_fix_reg_template_history'
|
down_revision = '0028_fix_reg_template_history'
|
||||||
|
|
||||||
@@ -14,10 +16,15 @@ from alembic import op
|
|||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
service_id = 'd6aa2c68-a2d9-4437-ab19-3ae8eb202553'
|
service_id = 'd6aa2c68-a2d9-4437-ab19-3ae8eb202553'
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
op.get_bind()
|
conn = op.get_bind()
|
||||||
op.execute("update services set email_from = 'testsender' where id = '{}'".format(service_id))
|
input_params = {
|
||||||
op.execute("update services_history set email_from = 'testsender' where id = '{}'".format(service_id))
|
"service_id": service_id
|
||||||
|
}
|
||||||
|
conn.execute(text("update services set email_from = 'testsender' where id = :service_id"), input_params)
|
||||||
|
conn.execute(text("update services_history set email_from = 'testsender' where id = :service_id"), input_params)
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ Create Date: 2017-05-31 11:43:55.744631
|
|||||||
import uuid
|
import uuid
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy import text
|
||||||
from sqlalchemy.dialects import postgresql
|
from sqlalchemy.dialects import postgresql
|
||||||
|
|
||||||
revision = '0091_letter_billing'
|
revision = '0091_letter_billing'
|
||||||
@@ -31,16 +32,34 @@ def upgrade():
|
|||||||
op.create_index(op.f('ix_letter_rate_details_letter_rate_id'), 'letter_rate_details', ['letter_rate_id'],
|
op.create_index(op.f('ix_letter_rate_details_letter_rate_id'), 'letter_rate_details', ['letter_rate_id'],
|
||||||
unique=False)
|
unique=False)
|
||||||
|
|
||||||
op.get_bind()
|
conn = op.get_bind()
|
||||||
letter_id = uuid.uuid4()
|
letter_id = uuid.uuid4()
|
||||||
op.execute("insert into letter_rates(id, valid_from) values('{}', '2017-03-31 23:00:00')".format(letter_id))
|
input_params = {
|
||||||
insert_details = "insert into letter_rate_details(id, letter_rate_id, page_total, rate) values('{}', '{}', {}, {})"
|
"letter_id": letter_id
|
||||||
op.execute(
|
}
|
||||||
insert_details.format(uuid.uuid4(), letter_id, 1, 29.3))
|
conn.execute(text("insert into letter_rates(id, valid_from) values(:letter_id, '2017-03-31 23:00:00')"), input_params)
|
||||||
op.execute(
|
insert_details = "insert into letter_rate_details(id, letter_rate_id, page_total, rate) values(:id, :letter_id, :page_total, :rate)"
|
||||||
insert_details.format(uuid.uuid4(), letter_id, 2, 32))
|
input_params = {
|
||||||
op.execute(
|
"id": uuid.uuid4(),
|
||||||
insert_details.format(uuid.uuid4(), letter_id, 3, 35))
|
"letter_id": letter_id,
|
||||||
|
"page_total": 1,
|
||||||
|
"rate": 29.3
|
||||||
|
}
|
||||||
|
conn.execute(text(insert_details), input_params)
|
||||||
|
input_params = {
|
||||||
|
"id": uuid.uuid4(),
|
||||||
|
"letter_id": letter_id,
|
||||||
|
"page_total": 2,
|
||||||
|
"rate": 32
|
||||||
|
}
|
||||||
|
conn.execute(text(insert_details), input_params)
|
||||||
|
input_params = {
|
||||||
|
"id": uuid.uuid4(),
|
||||||
|
"letter_id": letter_id,
|
||||||
|
"page_total": 3,
|
||||||
|
"rate": 35
|
||||||
|
}
|
||||||
|
conn.execute(text(insert_details), input_params)
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ Create Date: 2017-06-05 16:15:17.744908
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
|
from sqlalchemy import text
|
||||||
|
|
||||||
revision = '0099_tfl_dar'
|
revision = '0099_tfl_dar'
|
||||||
down_revision = '0098_service_inbound_api'
|
down_revision = '0098_service_inbound_api'
|
||||||
|
|
||||||
@@ -18,15 +20,23 @@ TFL_DAR_ID = '1d70f564-919b-4c68-8bdf-b8520d92516e'
|
|||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
op.execute("""INSERT INTO organisation VALUES (
|
conn = op.get_bind()
|
||||||
'{}',
|
input_params = {
|
||||||
|
"tfl_dar_id": TFL_DAR_ID
|
||||||
|
}
|
||||||
|
conn.execute(text("""INSERT INTO organisation VALUES (
|
||||||
|
:tfl_dar_id,
|
||||||
'',
|
'',
|
||||||
'tfl_dar_x2.png',
|
'tfl_dar_x2.png',
|
||||||
'tfl'
|
'tfl'
|
||||||
)""".format(TFL_DAR_ID))
|
)"""), input_params)
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
op.execute("""
|
conn = op.get_bind()
|
||||||
DELETE FROM organisation WHERE "id" = '{}'
|
input_params = {
|
||||||
""".format(TFL_DAR_ID))
|
"tfl_dar_id": TFL_DAR_ID
|
||||||
|
}
|
||||||
|
conn.execute(text("""
|
||||||
|
DELETE FROM organisation WHERE "id" = :tfl_dar_id
|
||||||
|
"""), input_params)
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ Create Date: 2017-08-29 14:09:41.042061
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
|
from sqlalchemy import text
|
||||||
|
|
||||||
revision = '0130_service_email_reply_to_row'
|
revision = '0130_service_email_reply_to_row'
|
||||||
down_revision = '0129_add_email_auth_permission'
|
down_revision = '0129_add_email_auth_permission'
|
||||||
|
|
||||||
@@ -18,16 +20,25 @@ EMAIL_REPLY_TO_ID = 'b3a58d57-2337-662a-4cba-40792a9322f2'
|
|||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
op.execute("""
|
conn = op.get_bind()
|
||||||
|
input_params = {
|
||||||
|
"email_reply_to": EMAIL_REPLY_TO_ID,
|
||||||
|
"notify_service_id": NOTIFY_SERVICE_ID
|
||||||
|
}
|
||||||
|
conn.execute(text("""
|
||||||
INSERT INTO service_email_reply_to
|
INSERT INTO service_email_reply_to
|
||||||
(id, service_id, email_address, is_default, created_at)
|
(id, service_id, email_address, is_default, created_at)
|
||||||
VALUES
|
VALUES
|
||||||
('{}','{}', 'testsender@dispostable.com', 'f', NOW())
|
(:email_reply_to, :notify_service_id, 'testsender@dispostable.com', 'f', NOW())
|
||||||
""".format(EMAIL_REPLY_TO_ID, NOTIFY_SERVICE_ID))
|
"""), input_params)
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
op.execute("""
|
conn = op.get_bind()
|
||||||
|
input_params = {
|
||||||
|
"email_reply_to": EMAIL_REPLY_TO_ID,
|
||||||
|
}
|
||||||
|
conn.execute(text("""
|
||||||
DELETE FROM service_email_reply_to
|
DELETE FROM service_email_reply_to
|
||||||
WHERE id = '{}'
|
WHERE id = :email_reply_to
|
||||||
""".format(EMAIL_REPLY_TO_ID))
|
"""), input_params)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ from datetime import datetime
|
|||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy import text
|
||||||
from sqlalchemy.dialects import postgresql
|
from sqlalchemy.dialects import postgresql
|
||||||
|
|
||||||
revision = '0151_refactor_letter_rates'
|
revision = '0151_refactor_letter_rates'
|
||||||
@@ -31,25 +32,39 @@ def upgrade():
|
|||||||
)
|
)
|
||||||
|
|
||||||
start_date = datetime(2016, 3, 31, 23, 00, 00)
|
start_date = datetime(2016, 3, 31, 23, 00, 00)
|
||||||
op.execute("insert into letter_rates values('{}', '{}', null, 1, 0.30, True, 'second')".format(
|
|
||||||
str(uuid.uuid4()), start_date)
|
|
||||||
)
|
|
||||||
op.execute("insert into letter_rates values('{}', '{}', null, 2, 0.33, True, 'second')".format(
|
|
||||||
str(uuid.uuid4()), start_date)
|
|
||||||
)
|
|
||||||
op.execute("insert into letter_rates values('{}', '{}', null, 3, 0.36, True, 'second')".format(
|
|
||||||
str(uuid.uuid4()), start_date)
|
|
||||||
)
|
|
||||||
|
|
||||||
op.execute("insert into letter_rates values('{}', '{}', null, 1, 0.33, False, 'second')".format(
|
conn = op.get_bind()
|
||||||
str(uuid.uuid4()), start_date)
|
input_params = {
|
||||||
)
|
"id": uuid.uuid4(),
|
||||||
op.execute("insert into letter_rates values('{}', '{}', null, 2, 0.39, False, 'second')".format(
|
"start_date": start_date
|
||||||
str(uuid.uuid4()), start_date)
|
}
|
||||||
)
|
conn.execute(text("insert into letter_rates values(:id, :start_date, null, 1, 0.30, True, 'second')"), input_params)
|
||||||
op.execute("insert into letter_rates values('{}', '{}', null, 3, 0.45, False, 'second')".format(
|
input_params = {
|
||||||
str(uuid.uuid4()), start_date)
|
"id": uuid.uuid4(),
|
||||||
)
|
"start_date": start_date
|
||||||
|
}
|
||||||
|
conn.execute(text("insert into letter_rates values(:id, :start_date, null, 2, 0.33, True, 'second')"), input_params)
|
||||||
|
input_params = {
|
||||||
|
"id": uuid.uuid4(),
|
||||||
|
"start_date": start_date
|
||||||
|
}
|
||||||
|
conn.execute(text("insert into letter_rates values(:id, :start_date, null, 3, 0.36, True, 'second')"), input_params)
|
||||||
|
|
||||||
|
input_params = {
|
||||||
|
"id": uuid.uuid4(),
|
||||||
|
"start_date": start_date
|
||||||
|
}
|
||||||
|
conn.execute(text("insert into letter_rates values(:id, :start_date, null, 1, 0.33, False, 'second')"), input_params)
|
||||||
|
input_params = {
|
||||||
|
"id": uuid.uuid4(),
|
||||||
|
"start_date": start_date
|
||||||
|
}
|
||||||
|
conn.execute(text("insert into letter_rates values(:id, :start_date, null, 2, 0.39, False, 'second')"), input_params)
|
||||||
|
input_params = {
|
||||||
|
"id": uuid.uuid4(),
|
||||||
|
"start_date": start_date
|
||||||
|
}
|
||||||
|
conn.execute(text("insert into letter_rates values(:id, :start_date, null, 3, 0.45, False, 'second')"), input_params)
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ Create Date: 2017-01-17 15:00:00.000000
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
|
from sqlalchemy import text
|
||||||
|
|
||||||
revision = '0159_add_historical_redact'
|
revision = '0159_add_historical_redact'
|
||||||
down_revision = '0158_remove_rate_limit_default'
|
down_revision = '0158_remove_rate_limit_default'
|
||||||
|
|
||||||
@@ -15,8 +17,13 @@ import sqlalchemy as sa
|
|||||||
from sqlalchemy.dialects import postgresql
|
from sqlalchemy.dialects import postgresql
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
op.execute(
|
conn = op.get_bind()
|
||||||
|
input_params = {
|
||||||
|
"notify_user": current_app.config['NOTIFY_USER_ID']
|
||||||
|
}
|
||||||
|
conn.execute(text(
|
||||||
"""
|
"""
|
||||||
INSERT INTO template_redacted
|
INSERT INTO template_redacted
|
||||||
(
|
(
|
||||||
@@ -29,12 +36,12 @@ def upgrade():
|
|||||||
templates.id,
|
templates.id,
|
||||||
false,
|
false,
|
||||||
now(),
|
now(),
|
||||||
'{notify_user}'
|
:notify_user
|
||||||
FROM
|
FROM
|
||||||
templates
|
templates
|
||||||
LEFT JOIN template_redacted on template_redacted.template_id = templates.id
|
LEFT JOIN template_redacted on template_redacted.template_id = templates.id
|
||||||
WHERE template_redacted.template_id IS NULL
|
WHERE template_redacted.template_id IS NULL
|
||||||
""".format(notify_user=current_app.config['NOTIFY_USER_ID'])
|
"""), input_params
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ Revises: 0198_add_caseworking_permission
|
|||||||
Create Date: 2017-07-09 12:44:16.815039
|
Create Date: 2017-07-09 12:44:16.815039
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
from sqlalchemy import text
|
||||||
|
|
||||||
revision = '0202_new_letter_pricing'
|
revision = '0202_new_letter_pricing'
|
||||||
down_revision = '0198_add_caseworking_permission'
|
down_revision = '0198_add_caseworking_permission'
|
||||||
@@ -27,10 +28,18 @@ NEW_RATES = [
|
|||||||
def upgrade():
|
def upgrade():
|
||||||
conn = op.get_bind()
|
conn = op.get_bind()
|
||||||
for id, start_date, sheet_count, rate, crown, post_class in NEW_RATES:
|
for id, start_date, sheet_count, rate, crown, post_class in NEW_RATES:
|
||||||
conn.execute("""
|
input_params = {
|
||||||
|
"id": id,
|
||||||
|
"start_date": start_date,
|
||||||
|
"sheet_count": sheet_count,
|
||||||
|
"rate": rate,
|
||||||
|
"crown": crown,
|
||||||
|
"post_class": post_class
|
||||||
|
}
|
||||||
|
conn.execute(text("""
|
||||||
INSERT INTO letter_rates (id, start_date, sheet_count, rate, crown, post_class)
|
INSERT INTO letter_rates (id, start_date, sheet_count, rate, crown, post_class)
|
||||||
VALUES ('{}', '{}', '{}', '{}', '{}', '{}')
|
VALUES (:id, :start_date, :sheet_count, :rate, :crown, :post_class)
|
||||||
""".format(id, start_date, sheet_count, rate, crown, post_class))
|
"""), input_params)
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ Create Date: 2019-02-15 11:20:25.812823
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
from alembic import op
|
from alembic import op
|
||||||
|
from sqlalchemy import text
|
||||||
|
|
||||||
revision = '0262_remove_edit_folders'
|
revision = '0262_remove_edit_folders'
|
||||||
down_revision = '0261_service_volumes'
|
down_revision = '0261_service_volumes'
|
||||||
@@ -17,11 +17,15 @@ def upgrade():
|
|||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
op.execute("""
|
conn = op.get_bind()
|
||||||
|
input_params = {
|
||||||
|
"permission": "edit_folders"
|
||||||
|
}
|
||||||
|
conn.execute(text("""
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
service_permissions (service_id, permission, created_at)
|
service_permissions (service_id, permission, created_at)
|
||||||
SELECT
|
SELECT
|
||||||
id, '{permission}', now()
|
id, :permission, now()
|
||||||
FROM
|
FROM
|
||||||
services
|
services
|
||||||
WHERE
|
WHERE
|
||||||
@@ -31,8 +35,6 @@ def downgrade():
|
|||||||
service_permissions
|
service_permissions
|
||||||
WHERE
|
WHERE
|
||||||
service_id = services.id and
|
service_id = services.id and
|
||||||
permission = '{permission}'
|
permission = :permission
|
||||||
)
|
)
|
||||||
""".format(
|
"""), input_params)
|
||||||
permission='edit_folders'
|
|
||||||
))
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ Create Date: 2019-05-13 10:44:51.867661
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
from alembic import op
|
from alembic import op
|
||||||
|
from sqlalchemy import text
|
||||||
|
|
||||||
revision = '0289_precompiled_for_all'
|
revision = '0289_precompiled_for_all'
|
||||||
down_revision = '0288_add_go_live_user'
|
down_revision = '0288_add_go_live_user'
|
||||||
@@ -18,12 +18,16 @@ def upgrade():
|
|||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
|
conn = op.get_bind()
|
||||||
op.execute("INSERT INTO service_permission_types values('precompiled_letter')")
|
op.execute("INSERT INTO service_permission_types values('precompiled_letter')")
|
||||||
op.execute("""
|
input_params = {
|
||||||
|
"permission": "precompiled_letter"
|
||||||
|
}
|
||||||
|
conn.execute(text("""
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
service_permissions (service_id, permission, created_at)
|
service_permissions (service_id, permission, created_at)
|
||||||
SELECT
|
SELECT
|
||||||
id, '{permission}', now()
|
id, :permission, now()
|
||||||
FROM
|
FROM
|
||||||
services
|
services
|
||||||
WHERE
|
WHERE
|
||||||
@@ -33,8 +37,7 @@ def downgrade():
|
|||||||
service_permissions
|
service_permissions
|
||||||
WHERE
|
WHERE
|
||||||
service_id = services.id and
|
service_id = services.id and
|
||||||
permission = '{permission}'
|
permission = :permission
|
||||||
)
|
)
|
||||||
""".format(
|
"""), input_params
|
||||||
permission='precompiled_letter'
|
)
|
||||||
))
|
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ def upgrade():
|
|||||||
organisation_types
|
organisation_types
|
||||||
(name, is_crown, annual_free_sms_fragment_limit)
|
(name, is_crown, annual_free_sms_fragment_limit)
|
||||||
VALUES
|
VALUES
|
||||||
('{}', false, 25000)
|
('nhs_gp', false, 25000)
|
||||||
""".format(GP_ORG_TYPE_NAME))
|
""")
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
@@ -32,11 +32,11 @@ def downgrade():
|
|||||||
SET
|
SET
|
||||||
organisation_type = 'nhs_local'
|
organisation_type = 'nhs_local'
|
||||||
WHERE
|
WHERE
|
||||||
organisation_type = '{}'
|
organisation_type = 'nhs_gp'
|
||||||
""".format(GP_ORG_TYPE_NAME))
|
""")
|
||||||
op.execute("""
|
op.execute("""
|
||||||
DELETE FROM
|
DELETE FROM
|
||||||
organisation_types
|
organisation_types
|
||||||
WHERE
|
WHERE
|
||||||
name = '{}'
|
name = 'nhs_gp'
|
||||||
""".format(GP_ORG_TYPE_NAME))
|
""")
|
||||||
|
|||||||
@@ -8,15 +8,19 @@ Create Date: 2021-04-01 08:00:24.775338
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
|
from sqlalchemy import text
|
||||||
|
|
||||||
revision = '0350_update_rates'
|
revision = '0350_update_rates'
|
||||||
down_revision = '0349_add_ft_processing_time'
|
down_revision = '0349_add_ft_processing_time'
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
op.get_bind()
|
conn = op.get_bind()
|
||||||
op.execute("INSERT INTO rates(id, valid_from, rate, notification_type) "
|
input_params = {
|
||||||
"VALUES('{}', '2021-03-31 23:00:00', 0.0160, 'sms')".format(uuid.uuid4()))
|
"id": uuid.uuid4()
|
||||||
|
}
|
||||||
|
conn.execute(text("INSERT INTO rates(id, valid_from, rate, notification_type) "
|
||||||
|
"VALUES(:id, '2021-03-31 23:00:00', 0.0160, 'sms')"), input_params)
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
|
|||||||
Reference in New Issue
Block a user