mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 23:41:17 -05:00
Rename migration file
This renames the latest migration file to match the Revision ID in the file. When these names are different, our deployment pipeline tries to run migrations on the notify-api-db-migration app and runs the functional tests twice.
This commit is contained in:
78
migrations/versions/0373_add_notifications_view.py
Normal file
78
migrations/versions/0373_add_notifications_view.py
Normal file
@@ -0,0 +1,78 @@
|
||||
"""
|
||||
|
||||
Revision ID: 0373_add_notifications_view
|
||||
Revises: 0372_remove_provider_rates
|
||||
Create Date: 2022-05-18 09:39:45.260951
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision = '0373_add_notifications_view'
|
||||
down_revision = '0372_remove_provider_rates'
|
||||
|
||||
|
||||
def upgrade():
|
||||
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,
|
||||
postage,
|
||||
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,
|
||||
postage,
|
||||
document_download_count
|
||||
FROM notification_history
|
||||
)
|
||||
""")
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.execute("DROP VIEW notifications_all_time_view")
|
||||
Reference in New Issue
Block a user