g4 / db-tools
数据库迁移相关工具
1.1.0
2023-11-08 08:56 UTC
Requires
- php: >=8.2
- g4/config: >=2.0.0
- g4/ruckusing-migrations: 2.*
README
使用方法
在项目文件夹内,需要创建以下一系列文件夹
db/
dumps/
logs/
migrations/
default/
根目录可以通过参数ruckusing_dir
进行配置。
命令行有一些必要的选项
ini - Relative path to application.ini which contain's database configuration files
env - Environment which will be read from application.ini
sql-dump - Relative path to SQL file that needs to be imported
ruckusing_dir - dir name of where database and migration related files are
示例
php vendor/g4/db-tools/bin/tools.php import:data env=$(env) sql-dump=${ND_API_SQL_DUMP} ini=${APPLICATION_INI} ruckusing_dir=${RUCKUSING_DIR}
php vendor/g4/db-tools/bin/ruckus.php db:status env=$(env) ini=${APPLICATION_INI} ruckusing_dir=${RUCKUSING_DIR}
这些变量应在Makefile内部定义,如下所示
APPLICATION_INI = application/setup/config/application.ini
RUCKUSING_DIR = db
ND_API_SQL_DUMP = $(RUCKUSING_DIR)/dumps/nd_api_v1.0.0.sql
GEONAME_SQL_DUMP = $(RUCKUSING_DIR)/dumps/geoname.compact.sql
使用以下命令将db-tools的Makefile目标导入项目的Makefile中
include vendor/g4/db-tools/dbtools.mk