Phalcon Migrations
Generate or migrate database changes via migrations.
Main idea of Phalcon migrations is to automatically detect changes and morphing without writing manual migrations.
Full documentation
Phalcon Documentation - Database Migrations
Requirements
- PHP >= 7.2
- Phalcon >= 4.0.5
- PHP ext-posix (Linux)
Installing via Composer
composer require --dev phalcon/migrations
Quick start
What you need for quick start:
- Configuration file (ex:
migrations.php) in root of your project (you can also pass them as parameters inside CLI environment) - Create database tables structure
- Execute command to generate migrations
After that you can execute that migrations (run) in another environment to create same DB structure.
Create configuration file
Configuration filename can be whatever you want.
<?php
use Phalcon\Config;
return new Config([
'database' => [
'adapter' => 'mysql',
'host' => '127.0.0.1',
'username' => 'root',
'password' => '',
'dbname' => 'db-name',
'charset' => 'utf8',
],
'application' => [
'logInDb' => true,
'no-auto-increment' => true,
'skip-ref-schema' => true,
'skip-foreign-checks' => true,
'migrationsDir' => 'db/migrations',
'migrationsTsBased' => true, // true - Use TIMESTAMP as version name, false - use versions
'exportDataFromTables' => [
// Tables names
// Attention! It will export data every new migration
],
],
]);Generate migrations
vendor/bin/phalcon-migrations generateOr if you have ready to use configuration file.
vendor/bin/phalcon-migrations generate --config=migrations.phpRun migrations
vendor/bin/phalcon-migrations runOr if you have ready to use configuration file.
vendor/bin/phalcon-migrations run --config=migrations.phpList existing migrations
vendor/bin/phalcon-migrations list

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
