Files
notifications-api/migrations/versions/0304_remove_org_to_service.py
T

39 lines
1.1 KiB
Python
Raw Normal View History

2019-08-15 15:17:53 +01:00
"""
Revision ID: 0304_remove_org_to_service
Revises: 0303_populate_services_org_id
Create Date: 2019-08-15 14:49:00.754390
"""
import sqlalchemy as sa
2023-12-08 21:43:52 -05:00
from alembic import op
2019-08-15 15:17:53 +01:00
from sqlalchemy.dialects import postgresql
2023-08-29 14:54:30 -07:00
revision = "0304_remove_org_to_service"
down_revision = "0303_populate_services_org_id"
2019-08-15 15:17:53 +01:00
def upgrade():
2023-08-29 14:54:30 -07:00
op.drop_table("organisation_to_service")
2019-08-15 15:17:53 +01:00
def downgrade():
2023-08-29 14:54:30 -07:00
op.create_table(
"organisation_to_service",
sa.Column("service_id", postgresql.UUID(), autoincrement=False, nullable=False),
sa.Column(
"organisation_id", postgresql.UUID(), autoincrement=False, nullable=False
),
sa.ForeignKeyConstraint(
["organisation_id"],
["organisation.id"],
name="organisation_to_service_organisation_id_fkey",
),
sa.ForeignKeyConstraint(
["service_id"],
["services.id"],
name="organisation_to_service_service_id_fkey",
),
sa.PrimaryKeyConstraint("service_id", name="organisation_to_service_pkey"),
)