Add support for 'CASCADE' in PostgreSQL 'DROP SCHEMA' queries #3627
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'}` |
maximelkin
Jan 27, 2020
Collaborator
does this will work correct for cascade = false?
can you add unit test on this?
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 && |
wubzz
Jan 28, 2020
Member
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' : ''}
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? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
This commit adds the option of specifying
CASCADEto thedropSchemaanddropSchemaIfExistsmethods. Both methods maintain the current defaults.See the PostgreSQL: DROP SCHEMA documentation for more information.