承接 purocean/php-db-migration 相关项目开发

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

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

purocean/php-db-migration

Composer 安装命令:

composer require purocean/php-db-migration

包简介

A database migration tool

README 文档

README

仅支持 MySQL

使用

// migration.php
date_default_timezone_set('PRC');
$migrationConfig = [
    'tablePrefix' => 'test_prefix_', // 表前缀
    'migrationsPath' => __DIR__.'/migrations', // 迁移储存位置
    'dbConfig' => [ // 数据库配置
        'username' => 'root',
        'password' => '',
        'dsn' => 'mysql:host=localhost;port=3306;dbname=db_migration_test;charset=utf8',
    ]
];

(new \DbMigration\Cli($migrationConfig))->run();
php migration.php help

迁移示例:/test/migrations/m170119_101310_test_migration.php

功能

  • create 创建迁移
  • up 升级一个迁移
  • down 降级一个迁移
  • mark 讲某个迁移标记为已升级/未升级
  • new 显示未升级迁移
  • history 查看迁移历史

测试

cd test
vim config.php # 修改数据库配置
php test.php

MySQL

  • execute
  • createTable
  • renameTable
  • dropTable
  • truncateTable
  • addColumn
  • dropColumn
  • renameColumn
  • alterColumn
  • addPrimaryKey
  • dropPrimaryKey
  • addForeignKey
  • dropForeignKey
  • createIndex
  • dropIndex
  • addCommentOnColumn()
  • addCommentOnTable
  • dropCommentFromColumn
  • dropCommentFromTable
  • primaryKey
  • char
  • varchar
  • string
  • text
  • smallInteger
  • integer
  • bigInteger
  • float
  • double
  • decimal
  • dateTime
  • timestamp
  • time
  • date
  • binary
  • boolean
  • notNull
  • null
  • unique
  • defaultValue
  • comment
  • unsigned
  • after
  • first
  • append

统计信息

  • 总下载量: 21
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-01-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固