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

Commit 1f429abc by Mick Hansen

Merge pull request #5231 from seegno-forks/enhancement/add-if-exists-to-drop-schema

Add `IF EXISTS` to Postgres drop schema query
2 parents fac5fabf 058acb95
......@@ -23,7 +23,7 @@ var QueryGenerator = {
},
dropSchema: function(schema) {
var query = 'DROP SCHEMA <%= schema%> CASCADE;';
var query = 'DROP SCHEMA IF EXISTS <%= schema%> CASCADE;';
return Utils._.template(query)({schema: schema});
},
......
'use strict';
var Support = require(__dirname + '/../support')
, expectsql = Support.expectsql
, current = Support.sequelize
, sql = current.dialect.QueryGenerator;
describe(Support.getTestDialectTeaser('SQL'), function() {
if (current.dialect.name === 'postgres') {
describe('dropSchema', function () {
test('IF EXISTS', function () {
expectsql(sql.dropSchema('foo'), {
postgres: 'DROP SCHEMA IF EXISTS foo CASCADE;'
});
});
});
}
});
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!