node-pg-migrate
Version:
PostgreSQL database migration management tool for node.js
16 lines (15 loc) • 571 B
JavaScript
import { dropSchema } from "./dropSchema.js";
function createSchema(mOptions) {
const _create = (schemaName, options = {}) => {
const { ifNotExists = false, authorization } = options;
const ifNotExistsStr = ifNotExists ? " IF NOT EXISTS" : "";
const schemaNameStr = mOptions.literal(schemaName);
const authorizationStr = authorization ? ` AUTHORIZATION ${authorization}` : "";
return `CREATE SCHEMA${ifNotExistsStr} ${schemaNameStr}${authorizationStr};`;
};
_create.reverse = dropSchema(mOptions);
return _create;
}
export {
createSchema
};