mirror of
https://github.com/knex/knex.git
synced 2025-12-28 07:29:16 +00:00
Throw better error when trying to modify schema while using unsupported dialect (#3609)
This commit is contained in:
parent
2800e72d2f
commit
80a2516734
@ -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
Loading…
x
Reference in New Issue
Block a user