sirodiaz / manticore-migration
Manticoresearch migration tool. Keep your index schemas up to date programmatically in your application
Requires
- php: >=7.4.0
- manticoresoftware/manticoresearch-php: ^1.8
- nyholm/dsn: ^2.0
- symfony/console: ^5.4.9
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- phpro/grumphp-shim: ^1.12
- phpstan/phpstan: ^1.6
- phpunit/phpunit: ^9.0
README
Manticoresearch migration tool. Keep updated your index schemas up to date using a executable CLI script or integrate it programmatically in your application code.
project progress and roadmap
- Add CI pipeline
- Add PHP versions supported
- 7.4
- 8.0
- 8.1
- PhpStan
- PHPUnit run tests
- Add PHP versions supported
- Pre-commit linter and tests checks
- Add Grumphp
- PHPStan
- PHPUnit
- Add Grumphp
- Add a logger implementation
- Add docker-compose stack files for testing and development
- Add code documentation
- Write a complete README file explaining all
- Add unit and integration tests
- Add command line interface feature
- Add cli application metadata such as name, description, etc.
- Created structure of the CLI application
- Executable script (bin/manticore-migration)
- Add commands
- list
- make:config
- make:migration
- migration:list:pending
- migration:list:migrated
- migrate
- rollback
- rollback with --steps
- fresh
- refresh
- refresh with --steps
- reset
- status
- help
- Add drivers to support multiple DBs engines dialects
- Add driver for SQLite
- Add driver for MySQL
- Add driver for PostgreSQL
- Create a Laravel package
- Create a Symfony package
Installation
composer require sirodiaz/manticore-migration
Usage
First of all, you need to install the package.
composer require sirodiaz/manticore-migration
After been installed, you need to create a directory. That directory will contain the migration files sorted by creation date.
You have two different ways to use this package:
- programmatically
- CLI
You can create your own integration with manticore-migration
using the programmatically way as you can see in hte examples directory in this repository.
In each section of these documentation you will see both: programmatically and CLI version to create, migrate, rollback, list applied and pending migrations.
Create migration
CLI
To create a migration file you have to use the make:migration and the class name (the migration class name that extends Migration class) using snake_case_style. This class name should be a descriptive name. It's better a long name for two reasons:
- to better understand what the migration does
- and for avoid duplicated class names
./vendor/bin/manticore-migration make:migration -c config.php create_products_index
programmatically
<?php
Apply migrations
CLI
There are two available commands for apply pending migrations using the Command Line Interface
./vendor/bin/manticore-migration migrate -c config.php
./vendor/bin/manticore-migration migrate:up -c config.php
programmatically
<?php
Rollback migration
CLI
There are two available commands to rollback applied migrations using the Command Line Interface
./vendor/bin/manticore-migration rollback -c config.php
./vendor/bin/manticore-migration migrate:down -c config.php
programmatically
<?php
List migrations applied history
CLI
For list pending migrations using the Command Line tool
./vendor/bin/manticore-migration migration:list:pending -c config.php
programmatically
<?php
List pending migrations
CLI
For list pending migrations using the Command Line tool
./vendor/bin/manticore-migration migration:list:pending -c config.php
programmatically
<?php