-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf9c768
commit 4dfc18f
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
final class BaseBrand extends AbstractMigration | ||
{ | ||
public function up(): void | ||
{ | ||
$this->struct(); | ||
$this->seed(); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
$this->table('base_brand')->drop()->save(); | ||
} | ||
|
||
private function struct(): void | ||
{ | ||
$sql = <<<'EOT' | ||
CREATE TABLE `base_brand` ( | ||
`brand_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', | ||
`company_id` bigint(20) unsigned NOT NULL COMMENT '公司ID', | ||
`status` enum('T','F') NOT NULL DEFAULT 'T' COMMENT '状态', | ||
`order_num` bigint(20) unsigned NOT NULL DEFAULT '500' COMMENT '排序', | ||
`brand_num` varchar(30) NOT NULL DEFAULT '' COMMENT '编号', | ||
`brand_name` varchar(30) NOT NULL DEFAULT '' COMMENT '名称', | ||
`brand_logo` varchar(130) NOT NULL DEFAULT '' COMMENT 'LOGO', | ||
`brand_about` text NOT NULL COMMENT '介绍', | ||
`update_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
`create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
`brand_letter` varchar(30) NOT NULL DEFAULT '' COMMENT '品牌首字母', | ||
`seo_keywords` varchar(30) NOT NULL COMMENT 'SEO关键字', | ||
PRIMARY KEY (`brand_id`) USING BTREE | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
EOT; | ||
$this->execute($sql); | ||
} | ||
|
||
private function seed(): void | ||
{ | ||
/* | ||
$sql = <<<'EOT' | ||
EOT; | ||
$this->execute($sql); | ||
*/ | ||
} | ||
} |