Fix db upgrade script b4456560d4f3 (#370)
* Recreating db upgrade error first * Wrapping alter table calls in try statements
This commit is contained in:
parent
3f0171b77b
commit
5597eb4cc4
|
|
@ -14,12 +14,20 @@ from alembic import op
|
|||
|
||||
|
||||
def upgrade():
|
||||
op.drop_constraint(
|
||||
u'tables_table_name_key', 'tables', type_='unique')
|
||||
op.create_unique_constraint(
|
||||
u'_customer_location_uc', 'tables',
|
||||
['database_id', 'schema', 'table_name'])
|
||||
try:
|
||||
# Trying since sqlite doesn't like constraints
|
||||
op.drop_constraint(
|
||||
u'tables_table_name_key', 'tables', type_='unique')
|
||||
op.create_unique_constraint(
|
||||
u'_customer_location_uc', 'tables',
|
||||
['database_id', 'schema', 'table_name'])
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_constraint(u'_customer_location_uc', 'tables', type_='unique')
|
||||
try:
|
||||
# Trying since sqlite doesn't like constraints
|
||||
op.drop_constraint(u'_customer_location_uc', 'tables', type_='unique')
|
||||
except Exception:
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -2,5 +2,6 @@
|
|||
rm /tmp/caravel_unittests.db
|
||||
rm -f .coverage
|
||||
export CARAVEL_CONFIG=tests.caravel_test_config
|
||||
set -e
|
||||
caravel/bin/caravel db upgrade
|
||||
python setup.py nosetests
|
||||
|
|
|
|||
Loading…
Reference in New Issue