Skip to content

v1.0.1 Release - Enhanced README for SQL to Migration

Latest

Choose a tag to compare

@bertugfahriozer bertugfahriozer released this 07 Sep 21:58
· 2 commits to master since this release

SQL to Migration for CodeIgniter 4 - Release Notes

v1.0.0 - 2025-09-08

Overview

We are excited to announce the initial release of SQL to Migration, a Spark command for CodeIgniter 4 that converts SQL dump files (e.g., from phpMyAdmin) into migration files. This release marks the foundation of a tool designed to streamline database migration workflows for CodeIgniter developers.

Key Features

  • Table Creation: Generates migration files from CREATE TABLE statements, supporting column types (INT, VARCHAR, etc.), UNSIGNED, NOT NULL, AUTO_INCREMENT, and PRIMARY KEY.
  • Foreign Key Support: Parses ALTER TABLE foreign key definitions, including ON DELETE and ON UPDATE actions (SET NULL, NO ACTION, CASCADE, RESTRICT, SET DEFAULT).
  • Trigger Handling: Creates migration files for CREATE TRIGGER statements (BEFORE/AFTER, INSERT/UPDATE/DELETE).
  • Prefix Management: Automatically strips database prefixes (e.g., ci4ms_) based on database.default.DBPrefix in .env.
  • CLI Debugging: Provides detailed logs for troubleshooting via the command line.

Installation

Install via Composer:

composer require yourvendor/sql-to-migration

Add to app/Config/Autoload.php:

public $psr4 = [
    APP_NAMESPACE => APPPATH,
    'Config'      => APPPATH . 'Config',
    'YourVendor\SqlToMigration' => VENDORPATH . 'yourvendor/sql-to-migration/src',
];

Run the command:

php spark sql2migration /path/to/your/database.sql

Known Issues

  • Limited support for complex SQL constraints (e.g., multi-column foreign keys). Future releases will address this.
  • Trigger parsing assumes standard MySQL syntax; non-standard formats may require adjustments.

Fixed Issues

  • Resolved issue where SET NULL and NO ACTION in foreign keys were partially parsed (only first word captured).

Next Steps

  • Plan to add support for additional SQL features (e.g., indexes, multi-column keys) in v1.1.0.
  • Improve documentation with advanced usage examples.

Changelog

  • v1.0.1 (2025-09-08): Updated README with detailed usage examples and troubleshooting guide.
  • v1.0.0 (Initial Release): Initial release with SQL to migration conversion support.

Contributions

We welcome feedback and contributions! Report issues or submit pull requests at github.com/yourusername/sql-to-migration. Thank you for trying out this release!