Skip to content

Commit

Permalink
squash
Browse files Browse the repository at this point in the history
  • Loading branch information
kalbfled committed Apr 23, 2024
1 parent 26cd426 commit 112aeb4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
6 changes: 4 additions & 2 deletions migrations/versions/0331_merge_service_apis.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"""
Revision ID: 0331_merge_service_apis
Revises: 0330a_grant_edit_templates
Create Date: 2021-07-01
"""

import json

from alembic import op
Expand All @@ -25,6 +24,9 @@ def upgrade():
'INSERT INTO service_callback_api (id, service_id, url, bearer_token, created_at, updated_at, updated_by_id, version, callback_type, notification_statuses)'
'SELECT id, service_id, url, bearer_token, created_at, updated_at, updated_by_id, version, \'inbound_sms\', \'{}\' FROM service_inbound_api'))

op.drop_index('ix_service_inbound_api_service_id', table_name='service_inbound_api', if_exists=True)
op.drop_index('ix_service_inbound_api_updated_by_id', table_name='service_inbound_api', if_exists=True)
op.drop_table('service_inbound_api')

op.rename_table('service_callback_api', 'service_callback')

Expand Down
21 changes: 0 additions & 21 deletions migrations/versions/0368_servicesmssender_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@


def upgrade():
# Migration 0331 moved rows in the service_inbound_api table to other tables but erroneously didn't drop the table.
op.drop_index('ix_service_inbound_api_service_id', table_name='service_inbound_api', if_exists=True)
op.drop_index('ix_service_inbound_api_updated_by_id', table_name='service_inbound_api', if_exists=True)
op.drop_table('service_inbound_api')

op.add_column('service_sms_senders', sa.Column('description', sa.String(length=256), nullable=True))
op.add_column('service_sms_senders', sa.Column('provider_id', postgresql.UUID(), nullable=True))
op.create_foreign_key(None, 'service_sms_senders', 'provider_details', ['provider_id'], ['id'])
Expand All @@ -27,19 +22,3 @@ def downgrade():
op.drop_constraint(None, 'service_sms_senders', type_='foreignkey')
op.drop_column('service_sms_senders', 'provider_id')
op.drop_column('service_sms_senders', 'description')

op.create_table('service_inbound_api',
sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
sa.Column('service_id', postgresql.UUID(), autoincrement=False, nullable=False),
sa.Column('url', sa.VARCHAR(), autoincrement=False, nullable=False),
sa.Column('bearer_token', sa.VARCHAR(), autoincrement=False, nullable=False),
sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
sa.Column('updated_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.Column('updated_by_id', postgresql.UUID(), autoincrement=False, nullable=False),
sa.Column('version', sa.INTEGER(), autoincrement=False, nullable=False),
sa.ForeignKeyConstraint(['service_id'], ['services.id'], name='service_inbound_api_service_id_fkey'),
sa.ForeignKeyConstraint(['updated_by_id'], ['users.id'], name='service_inbound_api_updated_by_id_fkey'),
sa.PrimaryKeyConstraint('id', name='service_inbound_api_pkey')
)
op.create_index('ix_service_inbound_api_updated_by_id', 'service_inbound_api', ['updated_by_id'], unique=False)
op.create_index('ix_service_inbound_api_service_id', 'service_inbound_api', ['service_id'], unique=True)

0 comments on commit 112aeb4

Please sign in to comment.