| 12345678910111213141516171819202122 |
- <?php
- $root = dirname(dirname(__DIR__));
- define('APP_PATH', $root . '/application/');
- require $root . '/thinkphp/base.php';
- \think\App::initCommon();
- function addColumn($table, $column, $ddl)
- {
- $prefix = \think\Db::getConfig('prefix');
- $full = $prefix . $table;
- $rows = \think\Db::query('SHOW COLUMNS FROM `' . $full . '` LIKE \'' . addslashes($column) . '\'');
- if ($rows) {
- echo $full . '.' . $column . " exists\n";
- return;
- }
- \think\Db::execute('ALTER TABLE `' . $full . '` ' . $ddl);
- echo $full . '.' . $column . " added\n";
- }
- addColumn('ps_product', 'qty', "ADD COLUMN `qty` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '总数量' AFTER `unit`");
- addColumn('ps_product', 'sheet_qty', "ADD COLUMN `sheet_qty` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '每版数量,一版一张流程单' AFTER `qty`");
- addColumn('ps_workorder', 'sheet_qty', "ADD COLUMN `sheet_qty` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '每版数量,一版一张流程单' AFTER `qty`");
|