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

Commit 058acb95 by Nuno Sousa

Add `IF EXISTS` to Postgres drop schema query

1 parent 4651cfbe
......@@ -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!