Download the PHP package peehaa/migres without Composer
On this page you can find all versions of the php package peehaa/migres. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download peehaa/migres
More information about peehaa/migres
Files in peehaa/migres
Informations about the package migres
Migres
The PostgreSQL migration tool
Requirements
- PHP 7.4
- PostgreSQL 9.5
Usage
Note: this is alpha software. Do not use in production (yet). I would appreciate if you could test it and provide feedback in GitHub issues. <3
Warning: never allow untrusted input in table specifications as all migrations are translated to raw SQL!
- Add the project using composer
composer install peehaa/migres
- Run the setup
./vendor/bin/migres setup
- Run without arguments to view the available commands
./vendor/bin/migres
All native PostgreSQL data types are implemented and the list can be found at: https://github.com/PeeHaa/migres/tree/master/src/DataType
TOC
- Creating a table
- Renaming a table
- Dropping a table
- Table methods
- addColumn
- dropColumn
- renameColumn
- changeColumn
- primaryKey
- namedPrimaryKey
- dropPrimaryKey
- renamePrimaryKey
- addUniqueConstraint
- dropUniqueConstraint
- addIndex
- addBtreeIndex
- addHashIndex
- addGistIndex
- addGinIndex
- dropIndex
- addCheck
- dropCheck
- Command line
- Setup
- Create new migration
- Run migrations
- Run rollbacks
Creating a table
Renaming a table
Dropping a table
Table methods
The table object defines the following methods:
Table::addColumn(string $name, \Migres\DataType\Type $dataType)
Table::dropColumn(string $name)
Table::renameColumn(string $oldName, string $newName)
Table::changeColumn(string $name, \Migres\DataType\Type $dataType)
Table::primaryKey(string $column, [string ...$columns])
Table::dropPrimaryKey([string $name])
Table::namedPrimaryKey(string $name, string $column, [string ...$columns])
Table::renamePrimaryKey(string $oldName, string $newName)
Table::addUniqueConstraint(string $constraintName, string $column, [string ...$columns])
Table::dropUniqueConstraint(string $constraintName)
Table::addIndex(string $indexName, string $column, [string ...$columns])
Table::addBtreeIndex(string $indexName, string $column, [string ...$columns])
Table::addHashIndex(string $indexName, string $column, [string ...$columns])
Table::addGistIndex(string $indexName, string $column, [string ...$columns])
Table::addGinIndex(string $indexName, string $column, [string ...$columns])
Table::dropIndex(string $indexName)
Table::addCheck(string $checkName, string $expression)
Table::dropCheck(string $checkName)
Command line
Setup
This will run the setup wizard which guides you through the process of setting up the configuration.
Create new migration
This will create a new migration and writes the file to the migrations directory.
Run migrations
Run the migrations
Run rollbacks
Rolls back the migrations
All versions of migres with dependencies
ext-ctype Version *
ext-json Version *
ext-pdo Version *
ext-readline Version *
league/climate Version ^3.5