Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@SteveDeWald
Copy link

This commit adds the option of specifying CASCADE to the dropSchema and dropSchemaIfExists methods. Both methods maintain the current defaults.

See the PostgreSQL: DROP SCHEMA documentation for more information.

this.pushQuery(`drop schema ${this.formatter.wrap(schemaName)}`);
SchemaCompiler_PG.prototype.dropSchema = function(schemaName, cascade = false) {
this.pushQuery(
`drop schema ${this.formatter.wrap(schemaName)}${cascade && ' CASCADE'}`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this will work correct for cascade = false?
can you add unit test on this?

cascade = false
) {
this.pushQuery(
`drop schema if exists ${this.formatter.wrap(schemaName)}${cascade &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would evaluate to drop schema if exists <tablename>false when cascade is false.

Please change to a ternary-operation.

drop schema if exists ${this.formatter.wrap(schemaName)}${cascade ? ' CASCADE' : ''}

@kibertoad
Copy link
Collaborator

@SteveDeWald Do you need any help writing a test?

@OlivierCavadenti
Copy link
Collaborator

Hi, I make the changes, rebase and tests to finish this PR but it seems I dont have permission to push : remote: Permission to SteveDeWald/knex.git denied to OlivierCavadenti.
How to fix that ?

@kibertoad
Copy link
Collaborator

@OlivierCavadenti I would suggest pushing to your own fork and creating a new PR, would be the easiest way.

@OlivierCavadenti
Copy link
Collaborator

@OlivierCavadenti I would suggest pushing to your own fork and creating a new PR, would be the easiest way.

Done here : #4713

@kibertoad
Copy link
Collaborator

Superseded by #4713

@kibertoad kibertoad closed this Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants