Download the PHP package marekskopal/orm-migrations without Composer
On this page you can find all versions of the php package marekskopal/orm-migrations. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download marekskopal/orm-migrations
More information about marekskopal/orm-migrations
Files in marekskopal/orm-migrations
Package orm-migrations
Short Description Migrations for MarekSkopal ORM.
License MIT
Informations about the package orm-migrations
ORM Migrations
Database migration library for marekskopal/orm. Automatically generates PHP migration files by comparing your ORM entity schema with the live database schema.
Supports MySQL and PostgreSQL.
Installation
Usage
Setup
For PostgreSQL, use PostgresDatabase instead of MySqlDatabase — no other changes needed.
An optional PSR-3 LoggerInterface can be passed as the third argument to Migrator to log migration execution.
Generate a migration
This compares the ORM entity schema against the live database and writes a new PHP migration file to the configured path. Only actual differences (added/changed/removed tables, columns, indexes, foreign keys) are included.
Example generated file:
Run migrations
Executes all pending migrations in order. Completed migrations are tracked in a __migrations table in the database.
TableBuilder API
Inside up() and down(), use $this->table(string $name) to get a TableBuilder. All methods are fluent and support both Type enum values and their string names.
Column operations
Index operations
Foreign key operations
Insert data
Available column types
Type enum |
MySQL | PostgreSQL |
|---|---|---|
Type::SmallInt |
smallint |
smallint |
Type::Int |
int |
integer |
Type::BigInt |
bigint |
bigint |
Type::Decimal |
decimal |
decimal |
Type::Float |
float |
real |
Type::Double |
double precision |
double precision |
Type::String |
varchar |
varchar |
Type::Text |
text |
text |
Type::Boolean |
tinyint(1) |
boolean |
Type::Uuid |
uuid |
uuid |
Type::Date |
date |
date |
Type::DateTime |
datetime |
timestamp |
Type::Timestamp |
timestamp |
timestamptz |
Type::Json |
json |
json |
Type::Enum |
enum(...) |
varchar + CHECK |
Migration file naming
Generated files use a Ymd_His_ timestamp prefix (e.g. 20240101_120000_CreateUserTable.php). Migrations are executed in filename order, so this ensures correct sequencing even across branches.
License
MIT
All versions of orm-migrations with dependencies
marekskopal/orm Version ^1.0
nette/php-generator Version ^4.1
psr/log Version ^3.0