phalcon / migrations
Run and Generate DB Migrations with Phalcon Framework
Fund package maintenance!
phalcon
Open Collective
Installs: 825 958
Dependents: 6
Suggesters: 0
Security: 0
Stars: 28
Watchers: 16
Forks: 25
Open Issues: 30
Requires
- php: >=7.4
- ext-phalcon: >=5.0.1
- nette/php-generator: ^3.5
- phalcon/cli-options-parser: ^1.2
Requires (Dev)
- ext-pdo: *
- codeception/codeception: ^4.1
- codeception/module-asserts: ^1.0.0
- codeception/module-cli: ^1.0
- codeception/module-db: ^1.0
- codeception/module-phpbrowser: ^1.0.0
- fakerphp/faker: ^1.15
- humbug/box: ^3.8
- phalcon/ide-stubs: ^5.0.1
- phpstan/phpstan: ^1.8
- squizlabs/php_codesniffer: ^3.5
- vimeo/psalm: ^4.6
- vlucas/phpdotenv: ^4.1
Suggests
- robmorgan/phinx: Phinx makes it ridiculously easy to manage the database migrations for your PHP app.
- dev-master
- v3.0.1
- v3.0.0
- v2.2.4
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.6
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- 2.0.x-dev
- v2.0.0
- 1.2.x-dev
- v1.2.2
- v1.2.1
- v1.2.0
- 1.1.x-dev
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-dependabot/composer/symfony/process-5.4.46
This package is auto-updated.
Last update: 2024-12-21 16:51:45 UTC
README
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.4
- Phalcon >= 5.0.0
- 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 generate
Or if you have ready to use configuration file.
vendor/bin/phalcon-migrations generate --config=migrations.php
Run migrations
vendor/bin/phalcon-migrations run
Or if you have ready to use configuration file.
vendor/bin/phalcon-migrations run --config=migrations.php
List existing migrations
vendor/bin/phalcon-migrations list