Download the PHP package alphasoft-fr/sql-migration without Composer
On this page you can find all versions of the php package alphasoft-fr/sql-migration. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package sql-migration
SQL Migration Utility
This is a utility library and commands for managing database migrations in SQL.
Installation
Use Composer
Composer Require
Requirements
- PHP version 8.1
Usage
Configuration
-
Create a configuration file named
migration-config.php
at the root of your project. You can use the following example as a starting point: - Customize the configuration options according to your needs. You can provide the PDO connection instance and specify the directory where migration files will be stored.
Generating a Migration File
You can generate a new migration file using the following command:
This will create a new migration file in the specified migrations directory with placeholder content for both the up and down migrations.
Modify the generated migration file with SQL queries corresponding to the intended migration:
Running Migrations
You can apply pending migrations using the following command:
This command will execute all pending migrations in ascending order of their version numbers. Successfully applied migrations will be displayed in the console output.
Rolling Back Migrations
You can revert the last applied migration using the following command:
Replace <version>
with the version number of the migration you want to revert. This command will execute the down migration for the specified version, effectively rolling back the changes made by that migration.
Contributing
If you encounter any issues or have suggestions for improvements, please feel free to open an issue on the GitHub repository.
License
This project is licensed under the MIT License. See the LICENSE file for details.