Skip to content

Migration tool should support other constraints and altering types of columns #250

Open
@mirolimsgd

Description

@mirolimsgd

Description;

Migration tool only supports UNIQUE constraints (other constraints are not yet supported). Keep this in mind when mutating schemas.
Changes in configuration such as altering varchar(255) to varchar(500) or changing datetime from null to now() are not handled.
Which is error prone and may increase debugging time.

Alternative approach switch to third party tools like Flyway/Liquibase

Limitations of the Custom Tool

  • Incomplete Feature Support: Feature set to properly detect and support (generate migration) for valid SQL definitions is strongly limited for example many types of constraints not supported, altering column type definitions not supported etc.
  • Fragility & Bugs: Recent work highlighted the complexity and potential for errors in correctly parsing SQL, building schema state, comparing states, and generating valid DDL across different scenarios.
  • High Maintenance Burden: Supporting the full range of PostgreSQL DDL features (indexes, functions, triggers, types, partitioning, etc.) and ensuring correctness requires significant ongoing development and maintenance effort for this custom tool.
  • Error Prone: The current limitations mean automatically generated migrations may be incomplete or incorrect, increasing the risk of schema inconsistencies and requiring developers to manually verify, edit, or create migrations anyway, partially defeating the tool's purpose.

These limitations make schema evolution error-prone and increase the time spent debugging the tool itself rather than building application features.

Proposed Alternative: Flyway / Liquibase

Why switch? (Benefits)

  • Maturity & Robustness: These tools are battle-tested across countless projects and databases. They reliably handle a vast array of schema changes.
  • Comprehensive Feature Support: They understand complex DDL, constraints, indexes, data migrations, procedure/function changes, etc., often supporting database-specific syntax.
  • Reduced Maintenance: We shift the burden of parsing SQL, managing schema state, and handling database specifics to the tool's maintainers/community. Our team focuses on defining the changes, not building the tool.
  • Strong Community & Documentation: Extensive resources, tutorials, and community support are available.
  • Standard Workflow: They promote standard migration practices (versioned SQL scripts for Flyway, declarative changesets for Liquibase) familiar to many developers.
  • Database Support: Designed to work well with PostgreSQL and other databases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions