Download the PHP package devture/mongodb-migrations without Composer
On this page you can find all versions of the php package devture/mongodb-migrations. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download devture/mongodb-migrations
More information about devture/mongodb-migrations
Files in devture/mongodb-migrations
Package mongodb-migrations
Short Description Managed Database Migrations for MongoDB
License MIT
Homepage http://github.com/devture/mongodb-migrations
Informations about the package mongodb-migrations
MongoDB Migrations
2022-02-05: This is a fork of the antimattr/mongodb-migrations
library, which makes it work on PHP 8 and Symfony 6.
The MongoDB Migration library provides managed migration support for MongoDB. It was moved to the doesntmattr organisation from antimattr/mongodb-migrations to continue maintenance (See issue 16).
The original authors are @rcatlin and @matthewfitz
It follows the structure and features provided by Doctrine Migrations.
PHP Version Support
If you require php 5.6 support use version ^1.0
. Version ^3.0
requires at least php 7.1. The 1.x
releases will only receive bug fixes.
Symfony Bundle
There is a Symfony Bundle you can install to more easily integrate with Symfony. Use the installation instructions there:
https://github.com/devture/mongodb-migrations-bundle
Installation
To install with composer:
Features
Configuration
Similar to Doctrine Migrations, configuration is separated into 2 files:
- Connection configuration (php)
- Migration configuration (xml or yaml)
Example connection configuration "test_antimattr_mongodb.php":
XML or YAML migration configuration files are supported.
Example XML "test_antimattr_mongodb.xml":
Example YAML "test_antimattr_mongodb.yml":
Console Command Support
There is an example Console Application in the /demo
directory.
This is how you can register commands in your application:
Notice the console is executable:
Generate a New Migration
Migrations Status
Migrate all
This is what you will execute during your deployment process.
Execute a Single Migration
If you need to run a migration again, you can use the --replay
argument.
Version Up or Down
Is your migration history out of sync for some reason? You can manually add or remove a record from the history without running the underlying migration.
You can delete:
You can add:
Analyze Migrations
Identify the collections you want to analyze. Statistics will be captured before and after the migration is run.
Execute JS Scripts
First identify the directory for scripts in your Migration Configuration:
Then execute the scripts via AbstractMigration::executeScript()
:
Contributing
PSR Standards
There is a git pre-commit hook that will fix all your contributed code to PSR standards.
You can install it with:
Testing
Tests should pass:
Code Sniffer and Fixer
If you didn't install the git pre-commit hook then ensure you run the fixer/sniffer manually:
All versions of mongodb-migrations with dependencies
ext-mongodb Version *
mongodb/mongodb Version ^1.8
symfony/console Version ^2.7 || ^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0
symfony/yaml Version ^2.7 || ^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0