Files
notifications-api/migrations/versions/0163_add_new_org_model.py
Katie Smith d40d520d2c Add Organisation model and migration
Now that we have renamed the 'old' organisation model to email_branding,
we can create a new organisation model.
2018-02-08 14:39:25 +00:00

35 lines
1.1 KiB
Python

"""
Revision ID: 0163_add_new_org_model
Revises: 0162_remove_org
Create Date: 2018-02-07 14:03:00.804849
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0163_add_new_org_model'
down_revision = '0162_remove_org'
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('organisation',
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('active', sa.Boolean(), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=False),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_organisation_name'), 'organisation', ['name'], unique=True)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_organisation_name'), table_name='organisation')
op.drop_table('organisation')
# ### end Alembic commands ###