mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-11 18:38:14 -04:00
reformat
This commit is contained in:
@@ -9,28 +9,32 @@ from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = '0260_remove_dvla_organisation'
|
||||
down_revision = '0259_remove_service_postage'
|
||||
revision = "0260_remove_dvla_organisation"
|
||||
down_revision = "0259_remove_service_postage"
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('services', 'dvla_organisation_id')
|
||||
op.drop_column('services_history', 'dvla_organisation_id')
|
||||
op.drop_table('dvla_organisation')
|
||||
op.drop_column("services", "dvla_organisation_id")
|
||||
op.drop_column("services_history", "dvla_organisation_id")
|
||||
op.drop_table("dvla_organisation")
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('dvla_organisation',
|
||||
sa.Column('id', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('name', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
|
||||
sa.Column('filename', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='dvla_organisation_pkey')
|
||||
op.create_table(
|
||||
"dvla_organisation",
|
||||
sa.Column("id", sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column("name", sa.VARCHAR(length=255), autoincrement=False, nullable=False),
|
||||
sa.Column(
|
||||
"filename", sa.VARCHAR(length=255), autoincrement=False, nullable=False
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id", name="dvla_organisation_pkey"),
|
||||
)
|
||||
# can't repopulate the services, but we can put the static data back in dvla_organisation
|
||||
op.execute("""
|
||||
op.execute(
|
||||
"""
|
||||
INSERT INTO dvla_organisation VALUES
|
||||
('001', 'HM Government', 'hm-government'),
|
||||
('002', 'Office of the Public Guardian', 'opg'),
|
||||
@@ -73,12 +77,47 @@ def downgrade():
|
||||
('528', 'North Yorkshire Council', 'north-yorkshire'),
|
||||
('529', 'Redbridge Council', 'redbridge'),
|
||||
('530', 'Wigan Council', 'wigan')
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
op.add_column('services_history', sa.Column('dvla_organisation_id', sa.VARCHAR(), server_default=sa.text("'001'::character varying"), autoincrement=False, nullable=False))
|
||||
op.add_column('services', sa.Column('dvla_organisation_id', sa.VARCHAR(), server_default=sa.text("'001'::character varying"), autoincrement=False, nullable=False))
|
||||
op.add_column(
|
||||
"services_history",
|
||||
sa.Column(
|
||||
"dvla_organisation_id",
|
||||
sa.VARCHAR(),
|
||||
server_default=sa.text("'001'::character varying"),
|
||||
autoincrement=False,
|
||||
nullable=False,
|
||||
),
|
||||
)
|
||||
op.add_column(
|
||||
"services",
|
||||
sa.Column(
|
||||
"dvla_organisation_id",
|
||||
sa.VARCHAR(),
|
||||
server_default=sa.text("'001'::character varying"),
|
||||
autoincrement=False,
|
||||
nullable=False,
|
||||
),
|
||||
)
|
||||
|
||||
op.create_index('ix_services_history_dvla_organisation_id', 'services_history', ['dvla_organisation_id'], unique=False)
|
||||
op.create_foreign_key('services_dvla_organisation_id_fkey', 'services', 'dvla_organisation', ['dvla_organisation_id'], ['id'])
|
||||
op.create_index('ix_services_dvla_organisation_id', 'services', ['dvla_organisation_id'], unique=False)
|
||||
op.create_index(
|
||||
"ix_services_history_dvla_organisation_id",
|
||||
"services_history",
|
||||
["dvla_organisation_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_foreign_key(
|
||||
"services_dvla_organisation_id_fkey",
|
||||
"services",
|
||||
"dvla_organisation",
|
||||
["dvla_organisation_id"],
|
||||
["id"],
|
||||
)
|
||||
op.create_index(
|
||||
"ix_services_dvla_organisation_id",
|
||||
"services",
|
||||
["dvla_organisation_id"],
|
||||
unique=False,
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
Reference in New Issue
Block a user