mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-14 23:07:49 -04:00
progress on removing postage
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"""
|
||||
|
||||
Revision ID: 1358d15190ba
|
||||
Revision ID: 0384_remove_letter_branding_
|
||||
Revises: 0383_update_default_templates.py
|
||||
Create Date: 2023-02-09 22:24:07.187569
|
||||
|
||||
@@ -9,7 +9,7 @@ from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision = '1358d15190ba'
|
||||
revision = '0384_remove_letter_branding_'
|
||||
down_revision = '0383_update_default_templates.py'
|
||||
|
||||
|
||||
|
||||
150
migrations/versions/0385_remove postage_.py
Normal file
150
migrations/versions/0385_remove postage_.py
Normal file
@@ -0,0 +1,150 @@
|
||||
"""
|
||||
|
||||
Revision ID: 0385_remove postage_.py
|
||||
Revises: 0384_remove_letter_branding_
|
||||
Create Date: 2023-02-10 12:20:39.411493
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision = '0385_remove postage_.py'
|
||||
down_revision = '0384_remove_letter_branding_'
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
# we need to replace the entire notifications_all_time_view in order to update it
|
||||
op.execute("DROP VIEW notifications_all_time_view;")
|
||||
op.execute("""
|
||||
CREATE VIEW notifications_all_time_view AS
|
||||
(
|
||||
SELECT
|
||||
id,
|
||||
job_id,
|
||||
job_row_number,
|
||||
service_id,
|
||||
template_id,
|
||||
template_version,
|
||||
api_key_id,
|
||||
key_type,
|
||||
billable_units,
|
||||
notification_type,
|
||||
created_at,
|
||||
sent_at,
|
||||
sent_by,
|
||||
updated_at,
|
||||
notification_status,
|
||||
reference,
|
||||
client_reference,
|
||||
international,
|
||||
phone_prefix,
|
||||
rate_multiplier,
|
||||
created_by_id,
|
||||
document_download_count
|
||||
FROM notifications
|
||||
) UNION
|
||||
(
|
||||
SELECT
|
||||
id,
|
||||
job_id,
|
||||
job_row_number,
|
||||
service_id,
|
||||
template_id,
|
||||
template_version,
|
||||
api_key_id,
|
||||
key_type,
|
||||
billable_units,
|
||||
notification_type,
|
||||
created_at,
|
||||
sent_at,
|
||||
sent_by,
|
||||
updated_at,
|
||||
notification_status,
|
||||
reference,
|
||||
client_reference,
|
||||
international,
|
||||
phone_prefix,
|
||||
rate_multiplier,
|
||||
created_by_id,
|
||||
document_download_count
|
||||
FROM notification_history
|
||||
)
|
||||
""")
|
||||
|
||||
op.drop_column('notification_history', 'postage')
|
||||
op.drop_column('notifications', 'postage')
|
||||
op.drop_column('templates', 'postage')
|
||||
op.drop_column('templates_history', 'postage')
|
||||
op.drop_column('ft_billing', 'postage')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('ft_billing', sa.Column('postage', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('templates_history', sa.Column('postage', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('templates', sa.Column('postage', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('notifications', sa.Column('postage', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('notification_history', sa.Column('postage', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
|
||||
op.execute("DROP VIEW notifications_all_time_view;")
|
||||
op.execute("""
|
||||
CREATE VIEW notifications_all_time_view AS
|
||||
(
|
||||
SELECT
|
||||
id,
|
||||
job_id,
|
||||
job_row_number,
|
||||
service_id,
|
||||
template_id,
|
||||
template_version,
|
||||
api_key_id,
|
||||
key_type,
|
||||
billable_units,
|
||||
notification_type,
|
||||
created_at,
|
||||
sent_at,
|
||||
sent_by,
|
||||
updated_at,
|
||||
notification_status,
|
||||
reference,
|
||||
client_reference,
|
||||
international,
|
||||
phone_prefix,
|
||||
rate_multiplier,
|
||||
postage,
|
||||
created_by_id,
|
||||
document_download_count
|
||||
FROM notifications
|
||||
) UNION
|
||||
(
|
||||
SELECT
|
||||
id,
|
||||
job_id,
|
||||
job_row_number,
|
||||
service_id,
|
||||
template_id,
|
||||
template_version,
|
||||
api_key_id,
|
||||
key_type,
|
||||
billable_units,
|
||||
notification_type,
|
||||
created_at,
|
||||
sent_at,
|
||||
sent_by,
|
||||
updated_at,
|
||||
notification_status,
|
||||
reference,
|
||||
client_reference,
|
||||
international,
|
||||
phone_prefix,
|
||||
rate_multiplier,
|
||||
postage,
|
||||
created_by_id,
|
||||
document_download_count
|
||||
FROM notification_history
|
||||
)
|
||||
""")
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user