Download the PHP package stratdes/php-mongo-migrations without Composer
On this page you can find all versions of the php package stratdes/php-mongo-migrations. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stratdes/php-mongo-migrations
More information about stratdes/php-mongo-migrations
Files in stratdes/php-mongo-migrations
Package php-mongo-migrations
Short Description Manage changes for your MongoDB documents
License MIT
Informations about the package php-mongo-migrations
MongoDB Migrations
This command line application supports you in managing migrations for your MongoDB documents. These migrations should make part of your code changes and can be executed through your deployment.
Installation
Writing migrations
You can write you own migrations by implementing the Gruberro\MongoDbMigrations\MigrationInterface
interface:
You can optionally implement the Gruberro\MongoDbMigrations\RunAlwaysMigrationInterface
interface to ensure a migration class is executed on every run.
Implementing the Gruberro\MongoDbMigrations\ContextualMigrationInterface
will allow you to specify a list of contexts to give additional control to your migrations.
Take a look at the examples to get some more insights.
Using the command line interface
Now you can easily execute your migrations by starting the migration command:
Internal processing sequence
- Gathering all migrations from the configured directories
- Check for uniqueness (
getId()
) for all migrations - Ordering all migrations according their create date (
getCreateDate()
) - Locks other runs by creating a special document in
DATABASE_MIGRATIONS_LOCK
(take a look at thephp-mongodb-migrations:release-lock
command to release a lock manually) - Executes the migrations, if
- at least one context is matching (no context is always matching) and
- a migration has not been executed before or
- the migration is marked as run always.
- Stores a successfully executed migration in the collection
DATABASE_MIGRATIONS
. - Releases the run lock in
DATABASE_MIGRATIONS_LOCK
under any circumstances.
All versions of php-mongo-migrations with dependencies
mongodb/mongodb Version ^1.0.0
symfony/console Version ^3.0|^4.0|^5.0|^6.0|^7.0