当前位置: 首页 > 工具软件 > Phinx > 使用案例 >

Phinx使用总结

富凯旋
2023-12-01

cd yourapp 

php vendor/bin/phinx init . 初始化

php vendor/bin/phinx create TableName 第一个字符必须大写

$tableName = 'hangyeyinzi';
if ($this->hasTable($tableName)) {
$this->dropTable($tableName);
}

$this->table($tableName)
->addColumn('date', 'integer', ['limit' => 10, 'comment' => '日期代码格式20170624'])
->addColumn('yingshoulv', 'decimal', ['precision' => 30, 'scale' => 15, 'comment' => '营业收入增长率(取3年均值)'])
->addColumn('jinglilv', 'decimal', ['precision' => 30, 'scale' => 15, 'comment' => '净利润增长率(取3年均值)'])
->addColumn('jingzilv', 'decimal', ['precision' => 30, 'scale' => 15, 'comment' => '净资产收益率'])
->addColumn('shouyibi', 'decimal', ['precision' => 30, 'scale' => 15, 'comment' => '每股收益价格比(1/PE)'])
->addColumn('jingyingxianjinbi', 'decimal', ['precision' => 30, 'scale' => 15, 'comment' => '每股经营性现金流价格比(每股现金流/现价)'])
->addColumn('guxilv', 'decimal', ['precision' => 30, 'scale' => 15, 'comment' => '股息率'])
->addColumn('jingzibi', 'decimal', ['precision' => 30, 'scale' => 15, 'comment' => '每股净资产价格比(1/PB)'])
->addColumn('hs300_ratio', 'decimal', ['precision' => 30, 'scale' => 15, 'comment' => '沪深300行业权重占比aindexhs300closeweight'])
->addColumn('hid', 'integer', ['limit' => 10, 'comment' => '行业代码'])
->create();

php vendor/bin/phinx status -e Tag 查看指定环境的数据库状态

php vendor/bin/phinx migrate -e Tag 根据脚本生产表结构到数据库里面

php vendor/bin/phinx breakpoint -e Tag 打断点

php vendor/bin/phinx rollback  -e Tag -t 20170623083322 回退指定点脚步

 

转载于:https://www.cnblogs.com/zhaoguangjie/p/7154084.html

 类似资料: