不要怂,就是干,撸起袖子干!

Commit 599e1bd7 by Sushant

fix(query/removeConstraint): support schemas

1 parent eee3e1df
...@@ -696,7 +696,13 @@ class QueryGenerator { ...@@ -696,7 +696,13 @@ class QueryGenerator {
} }
removeConstraintQuery(tableName, constraintName) { removeConstraintQuery(tableName, constraintName) {
return `ALTER TABLE ${this.quoteIdentifiers(tableName)} DROP CONSTRAINT ${this.quoteIdentifiers(constraintName)}`; if (typeof tableName === 'string') {
tableName = this.quoteIdentifiers(tableName);
} else {
tableName = this.quoteTable(tableName);
}
return `ALTER TABLE ${tableName} DROP CONSTRAINT ${this.quoteIdentifiers(constraintName)}`;
} }
/* /*
......
...@@ -13,6 +13,17 @@ if (current.dialect.supports.constraints.dropConstraint) { ...@@ -13,6 +13,17 @@ if (current.dialect.supports.constraints.dropConstraint) {
default: 'ALTER TABLE [myTable] DROP CONSTRAINT [constraint_name]' default: 'ALTER TABLE [myTable] DROP CONSTRAINT [constraint_name]'
}); });
}); });
if (current.dialect.supports.schemas) {
it('schema', () => {
expectsql(sql.removeConstraintQuery({
tableName: 'myTable',
schema: 'inspections'
}, 'constraint_name'), {
default: 'ALTER TABLE [inspections].[myTable] DROP CONSTRAINT [constraint_name]'
});
});
}
}); });
}); });
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!