Throw better error when trying to modify schema while using unsupported dialect (#3609)

This commit is contained in:
Igor Savin 2020-01-05 00:04:41 +01:00 committed by GitHub
parent 2800e72d2f
commit 80a2516734
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 527 additions and 561 deletions

View File

@ -14,6 +14,12 @@ function SchemaCompiler(client, builder) {
this.sequence = [];
}
function throwOnlyPGError(operationName) {
throw new Error(
`${operationName} is not supported for this dialect (only PostgreSQL supports it currently).`
);
}
Object.assign(SchemaCompiler.prototype, {
pushQuery: pushQuery,
@ -25,6 +31,19 @@ Object.assign(SchemaCompiler.prototype, {
createTableIfNotExists: buildTable('createIfNot'),
createSchema: () => {
throwOnlyPGError('createSchema');
},
createSchemaIfNotExists: () => {
throwOnlyPGError('createSchemaIfNotExists');
},
dropSchema: () => {
throwOnlyPGError('dropSchema');
},
dropSchemaIfExists: () => {
throwOnlyPGError('dropSchemaIfExists');
},
alterTable: buildTable('alter'),
dropTablePrefix: 'drop table ',

File diff suppressed because it is too large Load Diff