sirodiaz/manticore-migration

Manticoresearch migration tool. Keep your index schemas up to date programmatically in your application

0.1 2022-06-27 08:41 UTC

This package is auto-updated.

Last update: 2022-09-28 13:13:47 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Manticoresearch migration tool. Keep updated your index schemas up to date using a executable CLI script or integrate it programmatically in your application code.

migrate and migrate:down

project progress and roadmap

  • Add CI pipeline
    • Add PHP versions supported
      • 7.4
      • 8.0
      • 8.1
    • PhpStan
    • PHPUnit run tests
  • Pre-commit linter and tests checks
    • Add Grumphp
      • PHPStan
      • PHPUnit
  • 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

migrate and migrate:down

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

migrate and migrate:down

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

migration:list:migrated

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

migration:list:pending

CLI

For list pending migrations using the Command Line tool

./vendor/bin/manticore-migration migration:list:pending -c config.php

programmatically

<?php