Skip to content

Add Native Support for ALGORITHM=INSTANT in Migrations for MYSQL #2323

@abhikaddy

Description

@abhikaddy

Currently, phinx does not natively support specifying ALGORITHM=INSTANT for MySQL migrations. ALGORITHM=INSTANT allows for schema changes (like adding columns) without requiring a table copy or affecting existing data, offering significant performance and downtime advantages for compatible operations.

This feature would enhance the flexibility and efficiency of database schema migrations, especially for users leveraging MySQL 8.0+ where ALGORITHM=INSTANT is available for certain DDL operations.

Proposed Solution:

Introduce a method or syntax in migrations to allow developers to specify the use of ALGORITHM=INSTANT explicitly for operations that support it.
Example:
$table->addColumn('new_column', 'string', ['algorithm' => 'instant'])->update();
Ensure fallback behavior is clearly defined if ALGORITHM=INSTANT is unsupported by the MySQL version or for the requested operation.
Benefits

Reduces downtime and performance impact during migrations for supported schema changes.
Aligns phinx with modern database practices and MySQL optimizations.
MySQL documentation on ALGORITHM=INSTANT.

Adding this feature will provide a smoother migration experience, particularly for large-scale production environments. It would also make phinx more competitive by leveraging cutting-edge database features.

Please let me know if further clarification or input is required!

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