"""add role

Revision ID: 221ccee39de7
Revises: <KEY>
Create Date: 2021-05-13 23:51:53.241485

"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = "221ccee39de7"
down_revision = "<KEY>"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "role",
        sa.Column("id", postgresql.UUID(), nullable=False),
        sa.Column("title", sa.String(), nullable=False),
        sa.Column("grade_id", postgresql.UUID(), nullable=False),
        sa.Column("practice_id", postgresql.UUID(), nullable=False),
        sa.Column("organisation_id", postgresql.UUID(), nullable=False),
        sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
        sa.Column("updated_at", sa.DateTime(timezone=True), nullable=True),
        sa.ForeignKeyConstraint(["grade_id"], ["grade.id"], ondelete="CASCADE"),
        sa.ForeignKeyConstraint(["organisation_id"], ["organisation.id"], ondelete="CASCADE"),
        sa.ForeignKeyConstraint(["practice_id"], ["practice.id"], ondelete="CASCADE"),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_index(op.f("ix_role_created_at"), "role", ["created_at"], unique=False)
    op.create_index(op.f("ix_role_title"), "role", ["title"], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f("ix_role_title"), table_name="role")
    op.drop_index(op.f("ix_role_created_at"), table_name="role")
    op.drop_table("role")
    # ### end Alembic commands ###

"""add role

Revision ID: 221ccee39de7
Revises: <KEY>
Create Date: 2021-05-13 23:51:53.241485

"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = "221ccee39de7"
down_revision = "<KEY>"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "role",
        sa.Column("id", postgresql.UUID(), nullable=False),
        sa.Column("title", sa.String(), nullable=False),
        sa.Column("grade_id", postgresql.UUID(), nullable=False),
        sa.Column("practice_id", postgresql.UUID(), nullable=False),
        sa.Column("organisation_id", postgresql.UUID(), nullable=False),
        sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
        sa.Column("updated_at", sa.DateTime(timezone=True), nullable=True),
        sa.ForeignKeyConstraint(["grade_id"], ["grade.id"], ondelete="CASCADE"),
        sa.ForeignKeyConstraint(["organisation_id"], ["organisation.id"], ondelete="CASCADE"),
        sa.ForeignKeyConstraint(["practice_id"], ["practice.id"], ondelete="CASCADE"),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_index(op.f("ix_role_created_at"), "role", ["created_at"], unique=False)
    op.create_index(op.f("ix_role_title"), "role", ["title"], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f("ix_role_title"), table_name="role")
    op.drop_index(op.f("ix_role_created_at"), table_name="role")
    op.drop_table("role")
    # ### end Alembic commands ###

add role  Revision ID: 221ccee39de7 Revises: <KEY> Create Date: 2021-05-13 23:51:53.241485 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###