fix db migration
This commit is contained in:
parent
b4a2915d89
commit
718b702877
1 changed files with 6 additions and 6 deletions
|
|
@ -17,12 +17,12 @@ depends_on = None
|
|||
|
||||
|
||||
def upgrade():
|
||||
# Drop old check constraint FIRST (before updating data)
|
||||
op.drop_constraint('memory_units_fact_type_check', 'memory_units', type_='check')
|
||||
|
||||
# Update existing 'bank' values to 'interactions'
|
||||
op.execute("UPDATE memory_units SET fact_type = 'interactions' WHERE fact_type = 'bank'")
|
||||
|
||||
# Drop old check constraint
|
||||
op.drop_constraint('memory_units_fact_type_check', 'memory_units', type_='check')
|
||||
|
||||
# Create new check constraint with 'interactions' instead of 'bank'
|
||||
op.create_check_constraint(
|
||||
'memory_units_fact_type_check',
|
||||
|
|
@ -32,12 +32,12 @@ def upgrade():
|
|||
|
||||
|
||||
def downgrade():
|
||||
# Drop new check constraint FIRST
|
||||
op.drop_constraint('memory_units_fact_type_check', 'memory_units', type_='check')
|
||||
|
||||
# Update 'interactions' back to 'bank'
|
||||
op.execute("UPDATE memory_units SET fact_type = 'bank' WHERE fact_type = 'interactions'")
|
||||
|
||||
# Drop new check constraint
|
||||
op.drop_constraint('memory_units_fact_type_check', 'memory_units', type_='check')
|
||||
|
||||
# Recreate old check constraint
|
||||
op.create_check_constraint(
|
||||
'memory_units_fact_type_check',
|
||||
|
|
|
|||
Loading…
Reference in a new issue