Conversation
- Flyway-compatible clean dropping all schema objects - cleanDisabled flag (default: true) matching Flyway safety - CLI support with -cleanDisabled option - Flyway compatibility and unit tests
|
Hello. This is more an RFC than anything else. I was implementing this to replace flyway in some integration tests that use flyway clean. Just dropping all the schemas was not doing everyting I needed so I tried to replicate Flyway's behaviour as much as I can, and from what I understand. To be completely clear, I used an LLM to help with parts of this, namely testing. Feel free to add to your project or. If it's out of scope all fine, I am already using a similar logic internaly for my usecase. |
There was a problem hiding this comment.
Pull request overview
This pull request adds a clean command to Dumbo that drops all database objects in configured schemas, providing Flyway-compatible behavior. The implementation distinguishes between schemas created by Dumbo (which are dropped entirely) and pre-existing schemas (where objects are dropped individually in a specific order).
Changes:
- Implements
runCleanmethod with safety flagcleanDisabled(default: true) - Adds catalog queries to discover schema objects (materialized views, views, tables, types, routines, enums, domains, sequences)
- Integrates clean command into CLI with
-cleanDisabledflag - Includes comprehensive unit tests and Flyway compatibility tests
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| modules/core/shared/src/main/scala/dumbo/Dumbo.scala | Main clean implementation with schema drop logic and object cleanup ordered to handle dependencies |
| modules/core/shared/src/main/scala/dumbo/internal/CatalogQueries.scala | SQL queries to discover database objects, filtering out extension-owned objects |
| modules/core/shared/src/main/scala/dumbo/exception/DumboCleanException.scala | New exception class for clean operation errors |
| modules/core/shared/src/main/scala/dumbo/History.scala | Adds query to retrieve schemas created by Dumbo from history table |
| modules/cli/shared/src/main/scala/dumbo/cli/Dumbo.scala | CLI command handler for clean operation |
| modules/cli/shared/src/main/scala/dumbo/cli/Arguments.scala | Command and configuration definitions for clean |
| modules/tests/shared/src/test/scala/DumboMigrationSpec.scala | Unit tests for clean functionality including idempotency and disabled flag |
| modules/tests/shared/src/main/scala/ffstest/FFramework.scala | Test helper method for clean operations |
| modules/tests-flyway/src/test/scala/DumboFlywaySpec.scala | Flyway compatibility tests verifying clean leaves schema in same state |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Log what was actually cleaned (dropped vs cleaned schemas) instead of all configured schemas - Use parameterized query for progress monitor search_path comparison - Add quoteIdentifier utility following PostgreSQL/Flyway identifier quoting - Apply identifier quoting to all DDL statements using #$ interpolation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks for the contribution @ragb . I will take a closer look myself when I have time, we can probably merge it. For now I let copilot have a look and check whether CI passes. Looks like the major version needs to be updated to |
Will do. When reviewing, please note most of the copilot review comments make sense in general. I tried to follow what flyway does however, in the cases when I could improve easily, I did. |
Summary
cleancommand that drops all objects in configured schemasDROP SCHEMA CASCADE)doClean()order: materialized views, views, tables, base types (with recreate for circular deps), routines, enums, domains, sequences, base types (final cleanup)pg_dependcheckscleanDisabledflag (defaulttrue) matching Flyway's safety default-cleanDisabled=false clean