承接 phalcon/migrations 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

phalcon/migrations

最新稳定版本:v3.0.1

Composer 安装命令:

composer require phalcon/migrations

包简介

Run and Generate DB Migrations with Phalcon Framework

README 文档

README

Discord Packagist Version PHP from Packagist codecov Packagist

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

统计信息

  • 总下载量: 956.15k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 29
  • 点击次数: 2
  • 依赖项目数: 6
  • 推荐数: 0

GitHub 信息

  • Stars: 29
  • Watchers: 13
  • Forks: 26
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2019-10-19