Skip to content

Commit

Permalink
Fix db upgrade script b4456560d4f3 (#370)
Browse files Browse the repository at this point in the history
* Recreating db upgrade error first

* Wrapping alter table calls in try statements
  • Loading branch information
mistercrunch committed Apr 18, 2016
1 parent 3f0171b commit 5597eb4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Expand Up @@ -14,12 +14,20 @@


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
1 change: 1 addition & 0 deletions run_tests.sh
Expand Up @@ -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

0 comments on commit 5597eb4

Please sign in to comment.