PHPackages                             sharpen/versionna - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. sharpen/versionna

ActiveLibrary[Database &amp; ORM](/categories/database)

sharpen/versionna
=================

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

1.0(3y ago)4462[1 issues](https://github.com/trysharpen/versionna/issues)MITPHPPHP &gt;=8.0

Since Jun 27Pushed 3y ago1 watchersCompare

[ Source](https://github.com/trysharpen/versionna)[ Packagist](https://packagist.org/packages/sharpen/versionna)[ RSS](/packages/sharpen-versionna/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (3)Used By (0)

versionna
=========

[](#versionna)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5231add56a9e86f7bdbab1ce2973b92b9baffaae8df1b82119db21773a1777c8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7368617270656e2f76657273696f6e6e612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Sharpen/versionna)[![tests](https://github.com/trysharpen/versionna/actions/workflows/tests.yml/badge.svg)](https://github.com/trysharpen/versionna/actions/workflows/tests.yml)[![phpstan](https://github.com/trysharpen/versionna/actions/workflows/phpstan.yml/badge.svg)](https://github.com/trysharpen/versionna/actions/workflows/phpstan.yml)[![Total Downloads](https://camo.githubusercontent.com/fa707860ce83a9c7a65b8a571d1fbae40779182c244513596ab9467857b9c3ee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f5368617270656e2f76657273696f6e6e612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Sharpen/versionna)

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

[![migrate and migrate:down](./resources/migrate-migrate-down.gif)](./resources/migrate-migrate-down.gif)

Table of contents
=================

[](#table-of-contents)

- [versionna](#versionna)
- [Table of contents](#table-of-contents)
    - [project progress and roadmap](#project-progress-and-roadmap)
    - [Installation](#installation)
    - [Usage](#usage)
        - [Create migration](#create-migration)
            - [CLI](#cli)
            - [programmatically](#programmatically)
        - [Apply migrations](#apply-migrations)
            - [CLI](#cli-1)
            - [programmatically](#programmatically-1)
        - [Rollback migration](#rollback-migration)
            - [CLI](#cli-2)
            - [programmatically](#programmatically-2)
        - [List migrations applied history](#list-migrations-applied-history)
            - [CLI](#cli-3)
            - [programmatically](#programmatically-3)
        - [List pending migrations](#list-pending-migrations)
            - [CLI](#cli-4)
            - [programmatically](#programmatically-4)

project progress and roadmap
----------------------------

[](#project-progress-and-roadmap)

- Add CI pipeline
    - Add PHP versions supported
        - 8.0
        - 8.1
        - 8.2
    - 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/versionna)
- 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
------------

[](#installation)

```
composer require sharpen/versionna
```

Usage
-----

[](#usage)

First of all, you need to install the package.

```
composer require sharpen/versionna
```

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 `versionna` 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

[](#create-migration)

#### CLI

[](#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/versionna make:migration -c config.php create_products_index
```

#### programmatically

[](#programmatically)

```
