Skip to content

Conversation

@dgafka
Copy link
Member

@dgafka dgafka commented Jan 3, 2026

Why is this change proposed?

Currently Ecotone automatically creates tables when they are needed, and allow for opt out per feature solution.
However this lacks ability to set up all required tables before the actual code is executed, and disabling globally automatic table creation.

Therefore with this PR, Ecootne provides new Command that will allow for doing migration using CLI Command, or to print all the required SQLs in order to create those (and take over the process when some migration tooling is already being used).

This way we keep the natural behaviour of auto-setup, which allows to get users up to speed with Ecotone within minutes. Yet also provides a way for more robust and optimized way to deploy Ecotone by taking over the process of migration.

Description of Changes

ecotone:migration:database:setup

Purpose: Manages the setup and initialization of database tables required by Ecotone features (like dead letter storage, deduplication, document store, event sourcing, etc.).

Parameters

Parameter | Type | Default | Description -- | -- | -- | -- --initialize | boolean | false | Actually creates the database tables --sql | boolean | false | Shows the SQL statements that would be executed without running them --all | boolean | false | Includes inactive features in the operation

Behavior

  • Without flags: Lists all registered features and their initialization status (Yes/No)
  • With --sql: Returns the CREATE TABLE SQL statements for all features
  • With --initialize: Executes the table creation for all active features and shows which tables were created
  • With --all: Includes both active and inactive features in the operation

Output

Returns a table showing:

  • Feature names (e.g., "Dead Letter", "Document Store")
  • Status (Initialized: Yes/No, or Created when using --initialize)

Examples

# Check initialization status of all features
ecotone:migration:database:setup

# View SQL statements without executing
ecotone:migration:database:setup --sql

# Create all database tables
ecotone:migration:database:setup --initialize

# Create tables including inactive features
ecotone:migration:database:setup --initialize --all

ecotone:migration:database:drop

Purpose: Drops database tables created by Ecotone features.

Parameters

Parameter | Type | Default | Description -- | -- | -- | -- --force | boolean | false | Actually drops the tables (safety mechanism) --all | boolean | false | Includes inactive features in the operation

Behavior

  • Without --force: Shows a preview of which tables would be dropped with a warning message
  • With --force: Actually drops all the database tables for active features
  • With --all: Includes both active and inactive features in the drop operation

Output

Returns a table showing:

  • Feature names
  • Status ("Dropped" when forced, or "Would be dropped (use --force to confirm)" as a warning)

Examples

# Preview which tables would be dropped
ecotone:migration:database:drop

# Actually drop all tables (requires confirmation)
ecotone:migration:database:drop --force

# Drop tables including inactive features
ecotone:migration:database:drop --force --all

Disable all automatic table creations

#[ServiceContext]
public function dbalConfig()
{
      return DbalConfiguration::createWithDefaults()->withAutomaticTableInitialization(false);
}

Pull Request Contribution Terms

  • I have read and agree to the contribution terms outlined in CONTRIBUTING.

@dgafka dgafka merged commit a972636 into main Jan 3, 2026
11 of 12 checks passed
@dgafka dgafka deleted the feat/database-setup-command branch January 3, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants