Files
notifications-api/migrations/versions/0115_add_inbound_numbers.py
Cliff Hill 1157f5639d black, isort, flake8
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
2023-12-08 21:43:52 -05:00

46 lines
1.3 KiB
Python

"""empty message
Revision ID: 0115_add_inbound_numbers
Revises: 0014_drop_monthly_billing_cols
Create Date: 2017-08-10 17:30:01.507694
"""
# revision identifiers, used by Alembic.
revision = "0115_add_inbound_numbers"
down_revision = "0014_drop_monthly_billing_cols"
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
def upgrade():
op.create_table(
"inbound_numbers",
sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False),
sa.Column("number", sa.String(length=11), nullable=False),
sa.Column("provider", sa.String(), nullable=False),
sa.Column("service_id", postgresql.UUID(as_uuid=True), nullable=True),
sa.Column("active", sa.Boolean(), nullable=False),
sa.Column("created_at", sa.DateTime(), nullable=False),
sa.Column("updated_at", sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(
["service_id"],
["services.id"],
),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("number"),
)
op.create_index(
op.f("ix_inbound_numbers_service_id"),
"inbound_numbers",
["service_id"],
unique=True,
)
def downgrade():
op.drop_index(op.f("ix_inbound_numbers_service_id"), table_name="inbound_numbers")
op.drop_table("inbound_numbers")