Files
notifications-api/migrations/versions/0068_add_created_by_to_provider.py

77 lines
2.1 KiB
Python
Raw Normal View History

"""empty message
Revision ID: 0068_add_created_by_to_provider
Revises: 0067_service_contact_block
2017-03-08 09:49:47 +00:00
Create Date: 2017-03-06 17:19:28.492005
"""
# revision identifiers, used by Alembic.
2023-08-29 14:54:30 -07:00
revision = "0068_add_created_by_to_provider"
down_revision = "0067_service_contact_block"
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
2017-03-08 09:49:47 +00:00
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
2023-08-29 14:54:30 -07:00
op.add_column(
"provider_details",
sa.Column("created_by_id", postgresql.UUID(as_uuid=True), nullable=True),
)
op.create_index(
op.f("ix_provider_details_created_by_id"),
"provider_details",
["created_by_id"],
unique=False,
)
op.create_foreign_key(
"provider_details_created_by_id_fkey",
"provider_details",
"users",
["created_by_id"],
["id"],
)
op.add_column(
"provider_details_history",
sa.Column("created_by_id", postgresql.UUID(as_uuid=True), nullable=True),
)
2017-03-08 09:49:47 +00:00
op.create_index(
2023-08-29 14:54:30 -07:00
op.f("ix_provider_details_history_created_by_id"),
"provider_details_history",
["created_by_id"],
unique=False,
2017-03-08 09:49:47 +00:00
)
op.create_foreign_key(
2023-08-29 14:54:30 -07:00
"provider_details_history_created_by_id_fkey",
"provider_details_history",
"users",
["created_by_id"],
["id"],
2017-03-08 09:49:47 +00:00
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
2023-08-29 14:54:30 -07:00
op.drop_constraint(
"provider_details_history_created_by_id_fkey",
"provider_details_history",
type_="foreignkey",
)
op.drop_index(
op.f("ix_provider_details_history_created_by_id"),
table_name="provider_details_history",
)
op.drop_column("provider_details_history", "created_by_id")
op.drop_constraint(
"provider_details_created_by_id_fkey", "provider_details", type_="foreignkey"
)
op.drop_index(
op.f("ix_provider_details_created_by_id"), table_name="provider_details"
)
op.drop_column("provider_details", "created_by_id")
# ### end Alembic commands ###