Download the PHP package meritum/migrations without Composer
On this page you can find all versions of the php package meritum/migrations. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download meritum/migrations
More information about meritum/migrations
Files in meritum/migrations
Package migrations
Short Description Schema migration runner with a CLI interface for the Meritum ecosystem
License MIT
Informations about the package migrations
meritum/migrations
Schema migration runner with a CLI interface for the Meritum ecosystem.
Requirements
- PHP 8.4+
georgeff/kernel^1.6georgeff/database^1.0georgeff/schema^1.1meritum/cli^1.0
Installation
Configuration
All configuration is provided via environment variables. Source them before invoking strata or set them in your deployment environment.
| Variable | Default | Description |
|---|---|---|
DB_DRIVER |
pgsql |
Database driver — pgsql, mysql, or sqlite |
DB_HOST |
localhost |
Database host |
DB_PORT |
5432 |
Database port |
DB_DATABASE |
(empty) | Database name |
DB_USERNAME |
(empty) | Database username |
DB_PASSWORD |
(empty) | Database password |
DB_PGSQL_SCHEMA |
public |
PostgreSQL schema |
DB_PGSQL_SSL_MODE |
prefer |
PostgreSQL SSL mode |
DB_MYSQL_CHARSET |
utf8mb4 |
MySQL charset |
DB_MIGRATIONS_TABLE |
migrations |
Table used to track ran migrations |
DB_MIGRATIONS_PATH |
./migrations |
Directory where migration files are stored |
APP_ENV |
production |
Application environment — affects production guards |
APP_DEBUG |
false |
Enable debug mode |
The DB_MIGRATIONS_PATH defaults to a migrations/ directory in whichever directory strata is invoked from. Running strata from the project root gives ./migrations without any additional configuration.
Commands
migration:install
Creates the migrations tracking table in the database. Run this once before using any other commands.
Use --force or -f to run in production environments:
Running migration:run calls migration:install automatically, so explicit installation is optional.
migration:make
Generates a new migration file in the configured migrations directory. The filename is prefixed with a timestamp automatically.
To generate a create table migration with a pre-filled stub:
To generate an alter table migration:
Omitting --create-table and --alter-table generates a blank migration. --create-table and --alter-table are mutually exclusive.
migration:run
Runs all pending migrations in chronological order. Migrations that have already run are skipped. All pending migrations are grouped into a single batch.
Use --force or -f to run in production:
migration:rollback
Rolls back all migrations in the last batch by calling their down() methods in reverse order.
Use --force or -f to run in production:
migration:status
Displays a table of all known migrations with their batch number and timestamp. Pending migrations appear with empty batch and timestamp columns.
Writing migrations
Migration files must return an anonymous class implementing MigrationInterface. The up() method applies the change; down() reverses it.
SchemaInterface exposes create(), alter(), drop(), dropIfExists(), and tableExists(). The Blueprint API is provided by georgeff/schema.
Kernel integration
MigrationsModule and DatabaseModule register all services with the kernel. Use KernelBuilder as the entry point:
To extend the kernel with additional modules or service definitions, pass a ServiceRegistrar:
KernelBuilder::build() accepts environment, registrar, and debug as named arguments.
License
MIT — see LICENSE.
All versions of migrations with dependencies
aura/sql Version ^6.0
georgeff/database Version ^1.0
georgeff/kernel Version ^1.6
georgeff/schema Version ^1.1
meritum/cli Version ^1.0