mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 08:35:15 -05:00
remove organisation from db
also make sure email branding is not nullable, because it shouldnt be
This commit is contained in:
45
migrations/versions/0162_remove_org.py
Normal file
45
migrations/versions/0162_remove_org.py
Normal file
@@ -0,0 +1,45 @@
|
||||
"""
|
||||
|
||||
Revision ID: 0162_remove_org
|
||||
Revises: 0161_email_branding
|
||||
Create Date: 2018-02-06 17:08:11.879844
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision = '0162_remove_org'
|
||||
down_revision = '0161_email_branding'
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('services', 'organisation_id')
|
||||
op.drop_column('services_history', 'organisation_id')
|
||||
|
||||
op.drop_table('organisation')
|
||||
|
||||
op.alter_column('service_email_branding', 'email_branding_id', nullable=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('services_history', sa.Column('organisation_id', postgresql.UUID(), autoincrement=False, nullable=True)) # noqa
|
||||
op.add_column('services', sa.Column('organisation_id', postgresql.UUID(), autoincrement=False, nullable=True))
|
||||
|
||||
op.create_table(
|
||||
'organisation',
|
||||
sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('colour', sa.VARCHAR(length=7), autoincrement=False, nullable=True),
|
||||
sa.Column('logo', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
|
||||
sa.Column('name', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
|
||||
sa.PrimaryKeyConstraint('id', name='organisation_pkey')
|
||||
)
|
||||
|
||||
op.create_index('ix_services_history_organisation_id', 'services_history', ['organisation_id'], unique=False)
|
||||
op.create_foreign_key('services_organisation_id_fkey', 'services', 'organisation', ['organisation_id'], ['id'])
|
||||
op.create_index('ix_services_organisation_id', 'services', ['organisation_id'], unique=False)
|
||||
|
||||
op.alter_column('service_email_branding', 'email_branding_id', nullable=True)
|
||||
Reference in New Issue
Block a user