-
Couldn't load subscription status.
- Fork 2.2k
Add support for 'CASCADE' in PostgreSQL 'DROP SCHEMA' queries #3627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| 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'}` |
There was a problem hiding this comment.
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 && |
There was a problem hiding this comment.
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' : ''}|
@SteveDeWald Do you need any help writing a test? |
|
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. |
|
@OlivierCavadenti I would suggest pushing to your own fork and creating a new PR, would be the easiest way. |
Done here : #4713 |
|
Superseded by #4713 |
This commit adds the option of specifying
CASCADEto thedropSchemaanddropSchemaIfExistsmethods. Both methods maintain the current defaults.See the PostgreSQL: DROP SCHEMA documentation for more information.