mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-11 10:28:55 -04:00
reformat
This commit is contained in:
@@ -7,39 +7,63 @@ from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision = '0363_cancelled_by_api_key'
|
||||
down_revision = '0362_broadcast_msg_event'
|
||||
revision = "0363_cancelled_by_api_key"
|
||||
down_revision = "0362_broadcast_msg_event"
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('broadcast_message', sa.Column('created_by_api_key_id', postgresql.UUID(as_uuid=True), nullable=True))
|
||||
op.add_column(
|
||||
'broadcast_message', sa.Column('cancelled_by_api_key_id', postgresql.UUID(as_uuid=True), nullable=True)
|
||||
"broadcast_message",
|
||||
sa.Column(
|
||||
"created_by_api_key_id", postgresql.UUID(as_uuid=True), nullable=True
|
||||
),
|
||||
)
|
||||
op.drop_constraint('broadcast_message_api_key_id_fkey', 'broadcast_message', type_='foreignkey')
|
||||
op.create_foreign_key(
|
||||
'broadcast_message_created_by_api_key_id_fkey',
|
||||
'broadcast_message',
|
||||
'api_keys',
|
||||
['created_by_api_key_id'],
|
||||
['id']
|
||||
op.add_column(
|
||||
"broadcast_message",
|
||||
sa.Column(
|
||||
"cancelled_by_api_key_id", postgresql.UUID(as_uuid=True), nullable=True
|
||||
),
|
||||
)
|
||||
op.drop_constraint(
|
||||
"broadcast_message_api_key_id_fkey", "broadcast_message", type_="foreignkey"
|
||||
)
|
||||
op.create_foreign_key(
|
||||
'broadcast_message_cancelled_by_api_key_id_fkey',
|
||||
'broadcast_message',
|
||||
'api_keys',
|
||||
['cancelled_by_api_key_id'],
|
||||
['id']
|
||||
"broadcast_message_created_by_api_key_id_fkey",
|
||||
"broadcast_message",
|
||||
"api_keys",
|
||||
["created_by_api_key_id"],
|
||||
["id"],
|
||||
)
|
||||
op.create_foreign_key(
|
||||
"broadcast_message_cancelled_by_api_key_id_fkey",
|
||||
"broadcast_message",
|
||||
"api_keys",
|
||||
["cancelled_by_api_key_id"],
|
||||
["id"],
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint('broadcast_message_created_by_api_key_id_fkey', 'broadcast_message', type_='foreignkey')
|
||||
op.drop_constraint('broadcast_message_cancelled_by_api_key_id_fkey', 'broadcast_message', type_='foreignkey')
|
||||
op.create_foreign_key('broadcast_message_api_key_id_fkey', 'broadcast_message', 'api_keys', ['api_key_id'], ['id'])
|
||||
op.drop_column('broadcast_message', 'cancelled_by_api_key_id')
|
||||
op.drop_column('broadcast_message', 'created_by_api_key_id')
|
||||
op.drop_constraint(
|
||||
"broadcast_message_created_by_api_key_id_fkey",
|
||||
"broadcast_message",
|
||||
type_="foreignkey",
|
||||
)
|
||||
op.drop_constraint(
|
||||
"broadcast_message_cancelled_by_api_key_id_fkey",
|
||||
"broadcast_message",
|
||||
type_="foreignkey",
|
||||
)
|
||||
op.create_foreign_key(
|
||||
"broadcast_message_api_key_id_fkey",
|
||||
"broadcast_message",
|
||||
"api_keys",
|
||||
["api_key_id"],
|
||||
["id"],
|
||||
)
|
||||
op.drop_column("broadcast_message", "cancelled_by_api_key_id")
|
||||
op.drop_column("broadcast_message", "created_by_api_key_id")
|
||||
# ### end Alembic commands ###
|
||||
|
||||
Reference in New Issue
Block a user