承接 garrcomm/easy-migrations 相关项目开发

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

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

garrcomm/easy-migrations

Composer 安装命令:

composer require garrcomm/easy-migrations

包简介

Easy database migrations

README 文档

README

For simpler applications with a database, complicated ORM like migrations are overkill, but database versioning is still very useful.

For that purpose, I created this package.

Configuration file

The configuration file is in ini format.
There are a few default locations where configuration files should be located. It's also possible to specify a config file with the --config-file [path] argument, or by specifying a specific config value with the --config [key] [value] argument.

If more then one config file is found and/or specified, they will be loaded in this sequence:

  1. migrator.ini.dist in the current working directory
  2. migrator.ini in the current working directory
  3. migrator.ini.dist in the current working directory plus "/config/"
  4. migrator.ini in the current working directory plus "/config/"
  5. migrator.ini.dist in the directory containing the migrator executable
  6. migrator.ini in the directory containing the migrator executable
  7. All config files specified by --config-file [path]
  8. All flags specified by --config [key] [value]

A config file for MySQLi can look like this:

[migrator]

; The path (relative from the configuration file) and namespace in which migrations will be added
path = app/migrations
;namespace = Migrations

; Default chmod for folders
;path_attr = 0755
; Default chmod for files
;file_attr = 0644

engine = mysqli

; MySQLi connection info
hostname = localhost
username = root
password = rootroot
database = mydatabase
port = 3306
;socket = /var/run/mysqld.sock

; Name of the versioning table
;version_table = _migration_versions

For SQLite3, the configation could be like this:

[migrator]

; The path (relative from the configuration file) and namespace in which migrations will be added
path = app/migrations
;namespace = Migrations

; Default chmod for folders
;path_attr = 0755
; Default chmod for files
;file_attr = 0644

engine = sqlite3

database = /private/database.db
; database_attr = 0644
; encryption_key = foobar

; Name of the versioning table
;version_table = _migration_versions

Sections other than [migrator] are ignored and values added with --config [key] [value] are interpreted as if they existed in the [migrator] section.

Values that are commented out in the example above are default values.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: CC-BY-SA-4.0
  • 更新时间: 2023-10-05