{"id":36994590,"url":"https://github.com/trysharpen/versionna","last_synced_at":"2026-01-13T23:46:49.324Z","repository":{"id":37606187,"uuid":"492450457","full_name":"trysharpen/versionna","owner":"trysharpen","description":"Sharpen Versionna is a PHP migration system to manage versioning of Manticoresearch. It includes a CLI tool to keep your Manticore index schemas and your data on sync.","archived":false,"fork":false,"pushed_at":"2022-12-31T10:45:55.000Z","size":18781,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-25T13:31:31.300Z","etag":null,"topics":["database","database-migrations","database-schema","database-versioning","full-text-search","fulltext","indexing","manticore-search","manticoresearch","migration","migration-automation","migrations","php","search","search-engine","sql","versioning"],"latest_commit_sha":null,"homepage":"https://trysharpen.com/versionna","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trysharpen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-15T10:10:15.000Z","updated_at":"2023-08-16T01:58:51.000Z","dependencies_parsed_at":"2022-08-25T19:10:50.993Z","dependency_job_id":null,"html_url":"https://github.com/trysharpen/versionna","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/trysharpen/versionna","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trysharpen%2Fversionna","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trysharpen%2Fversionna/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trysharpen%2Fversionna/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trysharpen%2Fversionna/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trysharpen","download_url":"https://codeload.github.com/trysharpen/versionna/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trysharpen%2Fversionna/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28405304,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","database-migrations","database-schema","database-versioning","full-text-search","fulltext","indexing","manticore-search","manticoresearch","migration","migration-automation","migrations","php","search","search-engine","sql","versioning"],"created_at":"2026-01-13T23:46:49.231Z","updated_at":"2026-01-13T23:46:49.304Z","avatar_url":"https://github.com/trysharpen.png","language":"PHP","readme":"# versionna\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/sharpen/versionna.svg?style=flat-square)](https://packagist.org/packages/Sharpen/versionna)\n[![tests](https://github.com/trysharpen/versionna/actions/workflows/tests.yml/badge.svg)](https://github.com/trysharpen/versionna/actions/workflows/tests.yml)\n[![phpstan](https://github.com/trysharpen/versionna/actions/workflows/phpstan.yml/badge.svg)](https://github.com/trysharpen/versionna/actions/workflows/phpstan.yml)\n[![Total Downloads](https://img.shields.io/packagist/dt/Sharpen/versionna.svg?style=flat-square)](https://packagist.org/packages/Sharpen/versionna)\n\nManticoresearch migration tool. Keep updated your index schemas up to date using an executable CLI script or integrate it programmatically in your application code.\n\n![migrate and migrate:down](./resources/migrate-migrate-down.gif)\n\n# Table of contents\n- [versionna](#versionna)\n- [Table of contents](#table-of-contents)\n  - [project progress and roadmap](#project-progress-and-roadmap)\n  - [Installation](#installation)\n  - [Usage](#usage)\n    - [Create migration](#create-migration)\n      - [CLI](#cli)\n      - [programmatically](#programmatically)\n    - [Apply migrations](#apply-migrations)\n      - [CLI](#cli-1)\n      - [programmatically](#programmatically-1)\n    - [Rollback migration](#rollback-migration)\n      - [CLI](#cli-2)\n      - [programmatically](#programmatically-2)\n    - [List migrations applied history](#list-migrations-applied-history)\n      - [CLI](#cli-3)\n      - [programmatically](#programmatically-3)\n    - [List pending migrations](#list-pending-migrations)\n      - [CLI](#cli-4)\n      - [programmatically](#programmatically-4)\n\n## project progress and roadmap\n  - [x] Add CI pipeline\n    - [x] Add PHP versions supported\n      - [x] 8.0\n      - [x] 8.1\n      - [x] 8.2\n    - [x] PhpStan\n    - [x] PHPUnit run tests\n  - Pre-commit linter and tests checks\n    - [x] Add Grumphp\n      - [x] PHPStan\n      - [x] PHPUnit\n  - [ ] Add a logger implementation\n  - [x] Add docker-compose stack files for testing and development\n  - [ ] Add code documentation\n  - [x] Write a complete README file explaining all\n  - [ ] Add unit and integration tests\n  - [x] Add command line interface feature\n    - [x] Add cli application metadata such as name, description, etc.\n    - [x] Created structure of the CLI application\n  - [x] Executable script (bin/versionna)\n  - [ ] Add commands\n    - [x] list\n    - [ ] make:config\n    - [x] make:migration\n    - [x] migration:list:pending\n    - [x] migration:list:migrated\n    - [x] migrate\n    - [x] rollback\n    - [ ] rollback with --steps\n    - [x] fresh\n    - [ ] refresh\n    - [ ] refresh with --steps\n    - [ ] reset\n    - [ ] status\n    - [x] help\n  - [x] Add drivers to support multiple DBs engines dialects\n    - [x] Add driver for SQLite\n    - [x] Add driver for MySQL\n    - [x] Add driver for PostgreSQL\n  - [ ] Create a Laravel package\n  - [ ] Create a Symfony package\n## Installation\n\n```sh\ncomposer require sharpen/versionna\n```\n\n## Usage\nFirst of all, you need to install the package.\n\n```sh\ncomposer require sharpen/versionna\n```\n\nAfter been installed, you need to create a directory.\nThat directory will contain the migration files sorted by creation date.\n\nYou have two different ways to use this package:\n\n  - programmatically\n  - CLI\n\nYou can create your own integration with `versionna` using the programmatically way as you can see in hte **examples** directory in this repository.\n\nIn each section of these documentation you will see both: programmatically and CLI version to create, migrate, rollback, list applied and pending migrations.\n### Create migration\n\n#### CLI\nTo create a migration file you have to use the make:migration and the class name (the migration class name that extends Migration class) using\nsnake_case_style.\nThis class name should be a descriptive name. It's better a long name for two reasons:\n  - to better understand what the migration does\n  - and for avoid duplicated class names\n```sh\n./vendor/bin/versionna make:migration -c config.php create_products_index\n```\n\n#### programmatically\n\n```php\n\u003c?php\n\nuse Sharpen\\Versionna\\MigrationCreator;\n\n$configuration = require 'config.php';\n\n$migrationName = 'create_users_index';\n$description = 'users initial definition of the rt index';\n$migrationCreator = new MigrationCreator(\n    $configuration['migrations_path'],\n    $migrationName,\n    $description,\n);\n\n$migrationCreator-\u003ecreate();\n\necho 'Migration created successfully';\n```\n\n\n### Apply migrations\n![migrate and migrate:down](./resources/migrate-migrate-down.gif)\n\n#### CLI\n\nThere are two available commands for apply pending migrations using the Command Line Interface\n\n```sh\n./vendor/bin/versionna migrate -c config.php\n```\n\n```sh\n./vendor/bin/versionna migrate:up -c config.php\n```\n\n#### programmatically\n\n```php\n\u003c?php\n\nuse Sharpen\\Versionna\\Manticore\\ManticoreConnection;\nuse Sharpen\\Versionna\\MigrationDirector;\nuse Sharpen\\Versionna\\Storage\\DatabaseConfiguration;\nuse Sharpen\\Versionna\\Storage\\DatabaseConnection;\nuse Sharpen\\Versionna\\Storage\\MigrationTable;\n\n$configuration = require 'config.php';\n\n$dbConnection = new DatabaseConnection(\n    DatabaseConfiguration::fromArray(\n        $configuration['connections']['mysql']\n    )\n);\n\n$manticoreConnection = new ManticoreConnection(\n    $configuration['manticore_connection']['host'],\n    $configuration['manticore_connection']['port'],\n);\n\n$migrationTable = new MigrationTable(\n    $dbConnection,\n    $configuration['table_prefix'],\n    $configuration['migration_table'],\n);\n\n$director = new MigrationDirector();\n\n$director\n    -\u003edbConnection($dbConnection)\n    -\u003emanticoreConnection($manticoreConnection)\n    -\u003emigrationsPath($configuration['migrations_path'])\n    -\u003emigrationTable($migrationTable);\n\nif (! $migrationTable-\u003eexists()) {\n    echo 'Migration table doesn\\'t exist';\n    exit(1);\n} elseif (! $director-\u003ehasPendingMigrations()) {\n    echo 'No pending migrations';\n\n    exit(0);\n}\n\ntry {\n    $director-\u003emigrate();\n} catch (Exception $exception) {\n    echo $exception-\u003egetMessage();\n\n    exit(1);\n}\n\necho 'Applied all migrations';\n```\n\n### Rollback migration\n![migrate and migrate:down](./resources/migrate-migrate-down.gif)\n\n#### CLI\n\nThere are two available commands to rollback applied migrations using the Command Line Interface\n\n```sh\n./vendor/bin/versionna rollback -c config.php\n```\n\n```sh\n./vendor/bin/versionna migrate:down -c config.php\n```\n\n#### programmatically\n\n```php\n\u003c?php\n\nuse Sharpen\\Versionna\\Manticore\\ManticoreConnection;\nuse Sharpen\\Versionna\\MigrationDirector;\nuse Sharpen\\Versionna\\Storage\\DatabaseConfiguration;\nuse Sharpen\\Versionna\\Storage\\DatabaseConnection;\nuse Sharpen\\Versionna\\Storage\\MigrationTable;\n\n$configuration = require 'config.php';\n\n$dbConnection = new DatabaseConnection(\n  DatabaseConfiguration::fromArray(\n    $configuration['connections']['mysql']\n  ),\n);\n\n$manticoreConnection = new ManticoreConnection(\n  $configuration['manticore_connection']['host'],\n  $configuration['manticore_connection']['port'],\n);\n\n$migrationTable = new MigrationTable(\n  $dbConnection,\n  $configuration['table_prefix'],\n  $configuration['migration_table']\n);\n\n$director = new MigrationDirector();\n$director\n  -\u003edbConnection($dbConnection)\n  -\u003emanticoreConnection($manticoreConnection)\n  -\u003emigrationsPath($configuration['migrations_path'])\n  -\u003emigrationTable($migrationTable);\n\n$steps = 1;\n\n$director-\u003eundoMigrations($steps);\n```\n### List migrations applied history\n![migration:list:migrated](./resources/migration-list-migrated.gif)\n\n#### CLI\n\nFor list pending migrations using the Command Line tool\n\n```sh\n./vendor/bin/versionna migration:list:pending -c config.php\n```\n#### programmatically\n\n```php\n\u003c?php\n\n$configuration = require 'config.php';\n\n$dbConnection = new DatabaseConnection(\n    DatabaseConfiguration::fromArray(\n        $configuration['connections']['mysql']\n    )\n);\n\n$migrationTable = new MigrationTable(\n    $dbConnection,\n    $configuration['table_prefix'],\n    $configuration['migration_table']\n);\n\n$ascending = false;\n\n$migrations = $migrationTable-\u003egetAll($ascending);\n\nif ($migrations) {\n    $migrationsDone = array_map(\n        function ($migration) {\n            return $migration-\u003etoArray();\n        },\n        $migrations,\n    );\n\n    var_dump($migrationsDone);\n} else {\n    echo 'The migration table is empty';\n}\n```\n\n### List pending migrations\n![migration:list:pending](./resources/migration-list-pending.gif)\n\n#### CLI\n\nFor list pending migrations using the Command Line tool\n\n```sh\n./vendor/bin/versionna migration:list:pending -c config.php\n```\n#### programmatically\n\n```php\n\u003c?php\n\nuse Sharpen\\Versionna\\Manticore\\ManticoreConnection;\nuse Sharpen\\Versionna\\MigrationDirector;\nuse Sharpen\\Versionna\\Storage\\DatabaseConfiguration;\nuse Sharpen\\Versionna\\Storage\\DatabaseConnection;\nuse Sharpen\\Versionna\\Storage\\MigrationTable;\n\n$dbConnection = new DatabaseConnection(\n    DatabaseConfiguration::fromArray(\n        $configuration['connections'][$connection]\n    )\n);\n\n$manticoreConnection = new ManticoreConnection(\n    $configuration['manticore_connection']['host'],\n    $configuration['manticore_connection']['port'],\n);\n\n$migrationTable = new MigrationTable(\n    $dbConnection,\n    $configuration['table_prefix'],\n    $configuration['migration_table']\n);\n\n$director = new MigrationDirector();\n\n$director\n    -\u003edbConnection($dbConnection)\n    -\u003emanticoreConnection($manticoreConnection)\n    -\u003emigrationsPath($configuration['migrations_path'])\n    -\u003emigrationTable($migrationTable);\n\n$pendingMigrations = $director-\u003egetPendingMigrations();\n\nif (count($pendingMigrations) \u003e 0) {\n    array_map(\n        function ($migration) {\n            return ['name' =\u003e $migration];\n        },\n        array_values(array_keys($pendingMigrations)),\n    );\n} else {\n    echo 'ManticoreSearch is up to date! no pending migrations';\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrysharpen%2Fversionna","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrysharpen%2Fversionna","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrysharpen%2Fversionna/lists"}