mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-15 17:52:26 -05:00
swap out org value on existing data before truncating
This commit is contained in:
@@ -17,14 +17,37 @@ def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.get_bind()
|
||||
|
||||
op.execute("TRUNCATE TABLE organisation_types CASCADE;")
|
||||
op.execute("INSERT INTO organisation_types VALUES ('state','f','250000'),('federal','f','250000'),('other','f','250000');")
|
||||
# bluntly swap out data
|
||||
op.execute("INSERT INTO organisation_types VALUES ('state','f','250000'),('federal','f','250000');")
|
||||
op.execute("UPDATE services SET organisation_type = 'federal';")
|
||||
op.execute("UPDATE organisation SET organisation_type = 'federal';")
|
||||
op.execute("UPDATE services_history SET organisation_type = 'federal';")
|
||||
|
||||
# remove uk values
|
||||
service_delete = """DELETE FROM organisation_types WHERE name IN
|
||||
('central','local','nhs','nhs_central','nhs_local','emergency_service','school_or_college','nhs_gp')
|
||||
"""
|
||||
op.execute(service_delete)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
service_insert = """INSERT INTO organisation_types VALUES
|
||||
('central','','250000')
|
||||
('local','f','25000')
|
||||
('nhs','','25000')
|
||||
('nhs_central','t','250000')
|
||||
('nhs_local','f','25000')
|
||||
('emergency_service','f','25000')
|
||||
('school_or_college','f','25000')
|
||||
('nhs_gp','f','25000')
|
||||
"""
|
||||
op.execute(service_insert)
|
||||
op.execute("UPDATE services SET organisation_type = 'central';")
|
||||
op.execute("UPDATE organisation SET organisation_type = 'central';")
|
||||
op.execute("UPDATE services_history SET organisation_type = 'central';")
|
||||
op.execute("DELETE FROM organisation_types WHERE name IN ('federal','state')")
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
Reference in New Issue
Block a user