mistercrunch closed pull request #4815: [migrations] Fixing issue #4810 URL: https://github.com/apache/incubator-superset/pull/4815
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/superset/assets/package-lock.json b/superset/assets/package-lock.json new file mode 100644 index 0000000000..707bc5caed --- /dev/null +++ b/superset/assets/package-lock.json @@ -0,0 +1,21 @@ +{ + "name": "superset", + "version": "0.23.0dev", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "node": { + "version": "9.11.0", + "resolved": "https://registry.npmjs.org/node/-/node-9.11.0.tgz", + "integrity": "sha512-a4HV43+rHSgYaoGVr5PfnpTmiDeL4AmFsXKzRhBbkDLeRjBoQYENHs7mNCHlQRb9VFKRqXD5FDmadQFPznkUuQ==", + "requires": { + "node-bin-setup": "1.0.6" + } + }, + "node-bin-setup": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/node-bin-setup/-/node-bin-setup-1.0.6.tgz", + "integrity": "sha512-uPIxXNis1CRbv1DwqAxkgBk5NFV3s7cMN/Gf556jSw6jBvV7ca4F9lRL/8cALcZecRibeqU+5dFYqFFmzv5a0Q==" + } + } +} diff --git a/superset/migrations/versions/f231d82b9b26_.py b/superset/migrations/versions/f231d82b9b26_.py index 8a2aa1a75d..8c64f5d94a 100644 --- a/superset/migrations/versions/f231d82b9b26_.py +++ b/superset/migrations/versions/f231d82b9b26_.py @@ -12,7 +12,6 @@ from alembic import op import sqlalchemy as sa -from sqlalchemy.exc import OperationalError from superset.utils import generic_find_uq_constraint_name @@ -25,9 +24,6 @@ 'metrics': 'metric_name', } -bind = op.get_bind() -insp = sa.engine.reflection.Inspector.from_engine(bind) - def upgrade(): @@ -60,13 +56,16 @@ def downgrade(): ) # Remove the previous missing uniqueness constraints. + bind = op.get_bind() + insp = sa.engine.reflection.Inspector.from_engine(bind) + for table, column in names.items(): with op.batch_alter_table(table, naming_convention=conv) as batch_op: batch_op.drop_constraint( - generic_find_uq_constraint_name( - table, - {column, 'datasource_id'}, - insp, - ) or 'uq_{}_{}'.format(table, column), - type_='unique', - ) + generic_find_uq_constraint_name( + table, + {column, 'datasource_id'}, + insp, + ) or 'uq_{}_{}'.format(table, column), + type_='unique', + ) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services