This commit is contained in:
Kenneth Kehl
2023-08-29 14:54:30 -07:00
parent 19dcd7a48b
commit 1ecb747c6d
588 changed files with 34100 additions and 23589 deletions

View File

@@ -9,37 +9,60 @@ from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0162_remove_org'
down_revision = '0161_email_branding'
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_column("services", "organisation_id")
op.drop_column("services_history", "organisation_id")
op.drop_table('organisation')
op.drop_table("organisation")
op.alter_column('service_email_branding', 'email_branding_id', nullable=False)
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.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_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.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.alter_column('service_email_branding', 'email_branding_id', nullable=True)
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)