feat: init

This commit is contained in:
2024-12-20 18:03:35 +08:00
commit cbfbb0cef7
77 changed files with 2169 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
<?php
use think\migration\Migrator;
class CreateProduct extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('product', ['engine' => 'InnoDB', 'comment' => '产品表']);
$table->addColumn('language_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '语言ID'])
->addColumn('category_id', 'integer', ['signed' => false , 'null' => true, 'comment' => '分类ID'])
->addColumn('spu', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '产品规格'])
->addColumn('name', 'string', ['limit' => 125, 'null' => false, 'default' => '', 'comment' => '产品名称'])
->addColumn('short_name', 'string', ['limit' => 64, 'null' => false, 'default' => '', 'comment' => '产品简称'])
->addColumn('cover_image', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '产品封面图片'])
->addColumn('desc', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '产品描述'])
->addColumn('video_img', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '产品视频封面'])
->addColumn('video_url', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '产品视频'])
->addColumn('is_sale', 'boolean', ['default' => 1, 'null' => false, 'comment' => '是否上架:1上架,0下架'])
->addColumn('is_new', 'boolean', ['default' => 0, 'null' => false, 'comment' => '是否新品:1新品,0非新品'])
->addColumn('is_hot', 'boolean', ['default' => 0, 'null' => false, 'comment' => '是否热销:1热销,0非热销'])
->addColumn('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序'])
->addColumn('detail', 'text', ['null' => true, 'comment' => '产品详情'])
->addColumn('status', 'boolean', ['null' => false, 'default' => 1, 'comment' => '状态:1启用,-1禁用'])
->addColumn('seo_title', 'string', ['limit' => 255, 'default' => null, 'comment' => 'seo标题'])
->addColumn('seo_keyword', 'string', ['limit' => 255, 'default' => null, 'comment' => 'seo关建词'])
->addColumn('seo_desc', 'string', ['limit' => 255, 'default' => null, 'comment' => 'seo描述'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addColumn('updated_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'update' => 'CURRENT_TIMESTAMP', 'comment' => '更新时间'])
->addColumn('deleted_at', 'timestamp', ['null' => true, 'comment' => '删除时间'])
->create();
}
}

View File

@@ -0,0 +1,38 @@
<?php
use think\migration\Migrator;
class CreateProductParams extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('product_params', ['engine' => 'InnoDB', 'comment' => '产品参数表']);
$table->addColumn('product_id', 'integer', ['signed' => false , 'null' => false, 'comment' => '产品ID'])
->addColumn('name', 'string', ['limit' => 125, 'null' => false, 'default' => '', 'comment' => '参数名'])
->addColumn('value', 'string', ['limit' => 125, 'null' => false, 'default' => '', 'comment' => '参数值'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addColumn('updated_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'update' => 'CURRENT_TIMESTAMP', 'comment' => '更新时间'])
->create();
}
}

View File

@@ -0,0 +1,40 @@
<?php
use think\migration\Migrator;
class CreateProductSku extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('product_sku', ['engine' => 'InnoDB', 'comment' => '产品SKU表']);
$table->addColumn('product_id', 'integer', ['signed' => false , 'null' => false, 'comment' => '产品ID'])
->addColumn('sku', 'string', ['limit' => 125, 'null' => false, 'default' => '', 'comment' => 'SKU名称'])
->addColumn('main_image', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '主图'])
->addColumn('photo_album', 'json', ['null' => true, 'default'=> null, 'comment' => '相册'])
->addColumn('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addColumn('updated_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'update' => 'CURRENT_TIMESTAMP', 'comment' => '更新时间'])
->create();
}
}

View File

@@ -0,0 +1,39 @@
<?php
use think\migration\Migrator;
class CreateProductRelated extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('product_related', ['engine' => 'InnoDB', 'comment' => '产品关联表']);
$table->addColumn('product_id', 'integer', ['signed' => true , 'null' => false, 'comment' => '产品ID'])
->addColumn('related_product_id', 'integer', ['signed' => true , 'null' => false, 'comment' => '关联的产品ID'])
->addColumn('desc', 'string', ['limit' => 255, 'default' => null, 'comment' => '描述信息'])
->addColumn('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addColumn('updated_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'update' => 'CURRENT_TIMESTAMP', 'comment' => '更新时间'])
->create();
}
}

View File

@@ -0,0 +1,43 @@
<?php
use think\migration\Migrator;
class CreateSysLanguage extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('sys_language', ['engine' => 'MyISAM', 'comment' => '语言表']);
$table->addColumn('country_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '国家ID'])
->addColumn('name', 'string', ['limit' => 64, 'null' => false, 'default' => '', 'comment' => '语言名称'])
->addColumn('code', 'string', ['limit' => 64, 'null' => false, 'default' => '', 'comment' => '语言编码'])
->addColumn('icon', 'string', ['limit' => 64, 'default' => null, 'comment' => '语言图标'])
->addColumn('url', 'string', ['limit' => 125, 'default' => null, 'comment' => '切换后访问的url'])
->addColumn('status', 'boolean', ['null' => false,'default' => 1, 'comment' => '状态:1启用,0禁用'])
->addColumn('is_default', 'boolean', ['null' => false, 'default' => 0, 'comment' => '是否默认:1是,0否'])
->addColumn('sort', 'integer', ['default' => 0, 'comment' => '排序'])
->addColumn('created_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addColumn('updated_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'update' => 'CURRENT_TIMESTAMP', 'comment' => '更新时间'])
->create();
}
}

View File

@@ -0,0 +1,40 @@
<?php
use think\migration\Migrator;
class CreateSysCountry extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('sys_country', ['engine' => 'MyISAM', 'comment' => '国家表']);
$table->addColumn('name', 'string', ['limit' => 120, 'null' => false, 'default' => '', 'comment' => '国家名称'])
->addColumn('code', 'string', ['limit' => 64, 'null' => false, 'default' => '', 'comment' => '国家代码'])
->addColumn('icon', 'string', ['limit' => 64, 'default' => null, 'comment' => '国家图标'])
->addColumn('status', 'boolean', ['default' => 1, 'comment' => '状态:1启用,0禁用'])
->addColumn('sort', 'integer', ['default' => 0, 'comment' => '排序'])
->addColumn('created_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addColumn('updated_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'update' => 'CURRENT_TIMESTAMP', 'comment' => '更新时间'])
->create();
}
}

View File

@@ -0,0 +1,39 @@
<?php
use think\migration\Migrator;
class CreateProductAttr extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('product_attr', ['engine' => 'InnoDB', 'comment' => '商品属性表']);
$table->addColumn('language_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '语言ID'])
->addColumn('attr_name', 'string', ['limit' => 64, 'signed' => false, 'null' => false, 'comment' => '属性ID'])
->addColumn('is_system', 'boolean', ['null' => false, 'default' => 0, 'comment' => '是否系统属性:1是,0否'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '新增时间'])
->addColumn('updated_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'update' => 'CURRENT_TIMESTAMP', 'comment' => '更新时间'])
->addColumn('deleted_at', 'timestamp', ['null' => true, 'comment' => '删除时间'])
->create();
}
}

View File

@@ -0,0 +1,38 @@
<?php
use think\migration\Migrator;
class CreateProductAttrProp extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('product_attr_prop', ['id' => false, 'engine' => 'InnoDB', 'comment' => '商品属性特征表']);
$table->addColumn('attr_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '属性ID'])
->addColumn('prop_name', 'string', ['limit' => 64, 'null' => false, 'comment' => '特征名'])
->addColumn('prop_value', 'string', ['limit' => 64, 'null' => false, 'comment' => '特征值'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '新增时间'])
->addForeignKey('attr_id', 'product_attr', 'id', ['update' => 'CASCADE', 'delete' => 'CASCADE'])
->create();
}
}

View File

@@ -0,0 +1,37 @@
<?php
use think\migration\Migrator;
class CreateProductSkuAttr extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('product_sku_attr', ['id' => false,'engine' => 'InnoDB', 'comment' => '产品SKU属性表']);
$table->addColumn('sku_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '产品SKU ID'])
->addColumn('attr_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '属性ID'])
->addColumn('prop_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '属性特征ID'])
->addForeignKey('sku_id', 'product_sku', 'id', ['update' => 'CASCADE', 'delete' => 'CASCADE'])
->create();
}
}

View File

@@ -0,0 +1,50 @@
<?php
use Phinx\Db\Adapter\MysqlAdapter;
use think\migration\Migrator;
class CreateProductCategory extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('product_category', ['engine' => 'InnoDB', 'comment' => '商品分类表']);
$table->addColumn('language_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '语言ID'])
->addColumn('unique_id', 'string', ['limit' => 64, 'null' => false, 'comment' => '唯一ID'])
->addColumn('pid', 'integer', ['signed' => false, 'null' => false, 'default' => 0, 'comment' => '父级ID'])
->addColumn('name', 'string', ['limit' => 64, 'null' => false, 'comment' => '分类名称'])
->addColumn('icon', 'string', ['limit' => 125, 'default' => null, 'comment' => '图标'])
->addColumn('desc', 'string', ['limit' => 255, 'default' => null, 'comment' => '描述信息'])
->addColumn('related_tco_category', 'string', ['limit' => 64, 'default' => null, 'comment' => '关联 tco(产品目录) 商品分类ID,多个用英文逗号分隔'])
->addColumn('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序'])
->addColumn('level', 'integer', ['limit' => MysqlAdapter::INT_TINY,'null' => false, 'default' => 1, 'comment' => '层级'])
->addColumn('is_show', 'boolean', ['null' => false, 'default' => 1, 'comment' => '是否显示:1是,0否'])
->addColumn('seo_title', 'string', ['limit' => 255, 'default' => null, 'comment' => 'SEO标题'])
->addColumn('seo_keywords', 'string', ['limit' => 255, 'default' => null, 'comment' => 'SEO关键字'])
->addColumn('seo_desc', 'string', ['limit' => 255, 'default' => null, 'comment' => 'SEO描述'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '新增时间'])
->addColumn('updated_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'update' => 'CURRENT_TIMESTAMP', 'comment' => '更新时间'])
->addColumn('deleted_at', 'timestamp', ['null' => true, 'comment' => '删除时间'])
->create();
}
}

View File

@@ -0,0 +1,46 @@
<?php
use think\migration\Migrator;
class CreateProductTcoCategory extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('product_tco_category', ['engine' => 'InnoDB', 'comment' => '产品目录分类同步记录表']);
$table->addColumn('language_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '语言ID'])
->addColumn('name', 'string', ['limit' => 64, 'null' => false, 'comment' => '分类名称'])
->addColumn('tco_id', 'integer', ['default' => null, 'comment' => '产品目录分类ID'])
->addColumn('tco_pid', 'integer', ['default' => null, 'comment' => '产品目录分类父级ID'])
->addColumn('tco_path', 'string', ['limit' => 120, 'default' => null, 'comment' => '产品目录分类上下级关联路径'])
->addColumn('erp_id', 'integer', ['default' => null, 'comment' => '分类在ERP中的ID'])
->addColumn('erp_pid', 'integer', ['default' => null, 'comment' => '分类在ERP中的父级ID'])
->addColumn('erp_path', 'string', ['limit' => 120, 'default' => null, 'comment' => '分类在ERP中的上下级关联路径'])
->addColumn('disabled', 'boolean', ['null' => false, 'default' => 0, 'comment' => '0为启用, 1为禁用'])
->addColumn('sync_time', 'integer', ['null' => false, 'default' => 0, 'comment' => '同步时间'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '新增时间'])
->addColumn('updated_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'update' => 'CURRENT_TIMESTAMP', 'comment' => '更新时间'])
->addColumn('deleted_at', 'timestamp', ['null' => true, 'comment' => '删除时间'])
->create();
}
}

View File

@@ -0,0 +1,38 @@
<?php
use think\migration\Migrator;
class CreateProductPurchasePlatform extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('product_purchase_platform', ['engine' => 'InnoDB', 'comment' => '产品购买平台表']);
$table->addColumn('language_id', 'integer', ['signed' => false , 'null' => false, 'comment' => '语言ID'])
->addColumn('platform', 'string', ['limit' => 64 , 'null' => false, 'comment' => '平台'])
->addColumn('desc', 'string', ['limit' => 255, 'default' => null, 'comment' => '描述'])
->addColumn('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->create();
}
}

View File

@@ -0,0 +1,39 @@
<?php
use think\migration\Migrator;
class CreateProductPurchaseLink extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('product_purchase_link', ['engine' => 'InnoDB', 'comment' => '产品购买链接表']);
$table->addColumn('language_id', 'integer', ['signed' => false , 'null' => false, 'comment' => '语言ID'])
->addColumn('product_id', 'integer', ['signed' => false , 'null' => false, 'comment' => '产品ID'])
->addColumn('platform_id', 'integer', ['signed' => false , 'null' => false, 'comment' => '平台ID'])
->addColumn('link', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '链接'])
->addColumn('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->create();
}
}

View File

@@ -0,0 +1,49 @@
<?php
use Phinx\Db\Adapter\MysqlAdapter;
use think\migration\Migrator;
class CreateArticleCategory extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('article_category', ['engine' => 'MyISAM', 'comment' => '文章分类表']);
$table->addColumn('language_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '语言ID'])
->addColumn('pid', 'integer', ['signed' => false, 'null' => false, 'default' => 0, 'comment' => '父级ID'])
->addColumn('name', 'string', ['limit' => 64, 'null' => false, 'comment' => '分类名称'])
->addColumn('short_name', 'string', ['limit' => 64, 'null' => false, 'comment' => '分类简称'])
->addColumn('icon', 'string', ['limit' => 125, 'default' => null, 'comment' => '图标'])
->addColumn('desc', 'string', ['limit' => 255, 'default' => null, 'comment' => '描述信息'])
->addColumn('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序'])
->addColumn('level', 'integer', ['limit' => MysqlAdapter::INT_TINY,'null' => false, 'default' => 1, 'comment' => '层级'])
->addColumn('is_show', 'boolean', ['null' => false, 'default' => 1, 'comment' => '是否显示:1是,0否'])
->addColumn('seo_title', 'string', ['limit' => 255, 'default' => null, 'comment' => 'SEO标题'])
->addColumn('seo_keywords', 'string', ['limit' => 255, 'default' => null, 'comment' => 'SEO关键字'])
->addColumn('seo_desc', 'string', ['limit' => 255, 'default' => null, 'comment' => 'SEO描述'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '新增时间'])
->addColumn('updated_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'update' => 'CURRENT_TIMESTAMP', 'comment' => '更新时间'])
->addColumn('deleted_at', 'timestamp', ['null' => true, 'comment' => '删除时间'])
->create();
}
}

View File

@@ -0,0 +1,53 @@
<?php
use think\migration\Migrator;
class CreateArticle extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('article', ['engine' => 'MyISAM', 'comment' => '文章表']);
$table->addColumn('language_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '语言ID'])
->addColumn('category_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '分类ID'])
->addColumn('title', 'string', ['limit' => 64, 'null' => false, 'comment' => '标题'])
->addColumn('author', 'string', ['limit' => 64, 'null' => true, 'default' => null, 'comment' => '作者'])
->addColumn('source', 'string', ['limit' => 64, 'null' => true, 'default' => null, 'comment' => '来源'])
->addColumn('image', 'string', ['limit' => 125, 'null' => true, 'default' => null, 'comment' => '封面图片'])
->addColumn('desc', 'string', ['limit' => 255, 'null' => true, 'default' => null, 'comment' => '描述信息'])
->addColumn('recommend', 'boolean', ['null' => false, 'default' => 0, 'comment' => '是否推荐:1是,0否'])
->addColumn('release_time', 'integer', ['null' => false, 'comment' => '发布时间'])
->addColumn('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序'])
->addColumn('link', 'string', ['limit' => 255, 'null' => true, 'default' => null, 'comment' => '外链'])
->addColumn('content', 'text', ['null' => false, 'comment' => '内容'])
->addColumn('view_count', 'integer', ['null' => false, 'default' => 0, 'comment' => '浏览量'])
->addColumn('praise_count', 'integer', ['null' => false, 'default' => 0, 'comment' => '点赞量'])
->addColumn('seo_title', 'string', ['limit' => 255, 'null' => true, 'default' => null, 'comment' => 'SEO标题'])
->addColumn('seo_keywords', 'string', ['limit' => 255, 'null' => true, 'default' => null, 'comment' => 'SEO关键字'])
->addColumn('seo_desc', 'string', ['limit' => 255, 'null' => true, 'default' => null, 'comment' => 'SEO描述'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addColumn('updated_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'update' => 'CURRENT_TIMESTAMP', 'comment' => '更新时间'])
->addColumn('deleted_at', 'timestamp', ['null' => true, 'comment' => '删除时间'])
->create();
}
}

View File

@@ -0,0 +1,41 @@
<?php
use think\migration\Migrator;
class CreateArticleLeaveMessage extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('article_leave_message', ['engine' => 'MyISAM', 'comment' => '文章留言表']);
$table->addColumn('article_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '文章ID'])
->addColumn('name', 'string', ['limit' => 64, 'null' => false, 'comment' => '姓名'])
->addColumn('email', 'string', ['limit' => 128, 'null' => false, 'comment' => '邮箱'])
->addColumn('content', 'text', ['null' => false, 'comment' => '内容'])
->addColumn('ip', 'string', ['limit' => 64, 'null' => false, 'comment' => 'IP'])
->addColumn('user_agent', 'string', ['limit' => 255, 'null' => false, 'comment' => 'UserAgent'])
->addColumn('is_audited', 'boolean', ['null' => false, 'default' => 0, 'comment' => '0待审核,1已审核'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->create();
}
}

View File

@@ -0,0 +1,43 @@
<?php
use think\migration\Migrator;
class CreateSysImage extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('sys_image', ['engine' => 'MyISAM', 'comment' => '图片表']);
$table->addColumn('language_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '语言ID'])
->addColumn('image_name', 'string', ['limit' => 125, 'null' => false, 'comment' => '图片名称'])
->addColumn('image_path', 'string', ['limit' => 125, 'null' => false, 'comment' => '图片路径'])
->addColumn('image_thumb', 'string', ['limit' => 125, 'null' => false, 'comment' => '缩略图路径'])
->addColumn('image_size', 'integer', ['null' => false, 'comment' => '图片大小'])
->addColumn('image_type', 'string', ['limit' => 125, 'null' => false, 'comment' => '图片类型'])
->addColumn('image_md5', 'string', ['limit' => 32, 'null' => false, 'comment' => '图片md5值'])
->addColumn('image_sha1', 'string', ['limit' => 40, 'null' => false, 'comment' => '图片sha1值'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addColumn('deleted_at', 'timestamp', ['null' => true, 'comment' => '删除时间'])
->create();
}
}

View File

@@ -0,0 +1,47 @@
<?php
use think\migration\Migrator;
class CreateVideo extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('video', ['engine' => 'MyISAM', 'comment' => '视频表']);
$table->addColumn('language_id', 'integer', ['signed' => false , 'null' => false, 'comment' => '语言ID'])
->addColumn('category_id', 'integer', ['signed' => false , 'null' => false, 'comment' => '分类ID'])
->addColumn('name', 'string', ['limit' => 64 , 'null' => false, 'comment' => '名称'])
->addColumn('desc', 'string', ['limit' => 255, 'null' => true, 'default' => null, 'comment' => '描述信息'])
->addColumn('image', 'string', ['limit' => 125, 'null' => false, 'comment' => '封面图片'])
->addColumn('video', 'string', ['limit' => 125, 'null' => false, 'comment' => '视频地址'])
->addColumn('link', 'string', ['limit' => 125, 'null' => true, 'default' => null, 'comment' => '外链地址'])
->addColumn('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序'])
->addColumn('recommend', 'boolean', ['null' => false, 'default' => 1, 'comment' => '是否推荐:1是,0否'])
->addColumn('seo_title', 'string', ['limit' => 255, 'default' => null, 'comment' => 'SEO标题'])
->addColumn('seo_keywords', 'string', ['limit' => 255, 'default' => null, 'comment' => 'SEO关键字'])
->addColumn('seo_desc', 'string', ['limit' => 255, 'default' => null, 'comment' => 'SEO描述'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addColumn('deleted_at', 'timestamp', ['null' => true, 'comment' => '删除时间'])
->create();
}
}

View File

@@ -0,0 +1,37 @@
<?php
use think\migration\Migrator;
class CreateVideoCategory extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('video_category', ['engine' => 'MyISAM', 'comment' => '视频分类表']);
$table->addColumn('language_id', 'integer', ['signed' => false , 'null' => false, 'comment' => '语言ID'])
->addColumn('name', 'string', ['limit' => 64 , 'null' => false, 'comment' => '分类名称'])
->addColumn('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序'])
->addColumn('is_show', 'boolean', ['null' => false, 'default' => 1, 'comment' => '是否显示:1是,0否'])
->create();
}
}

View File

@@ -0,0 +1,49 @@
<?php
use think\migration\Migrator;
class CreateAttachment extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('attachment', ['engine' => 'MyISAM', 'comment' => '附件表']);
$table->addColumn('language_id', 'integer', ['signed' => false , 'null' => false, 'comment' => '语言ID'])
->addColumn('category_id', 'integer', ['signed' => false , 'null' => false, 'comment' => '分类ID'])
->addColumn('name', 'string', ['limit' => 64 , 'null' => false, 'comment' => '名称'])
->addColumn('desc', 'string', ['limit' => 255, 'default' => null, 'comment' => '描述信息'])
->addColumn('image', 'string', ['limit' => 255, 'default' => null, 'comment' => '图片地址'])
->addColumn('applicable_to', 'string', ['limit' => 255, 'default' => null, 'comment' => '适用于(型号),多个以英文逗号分隔'])
->addColumn('support_platform', 'string', ['limit' => 255, 'default' => null, 'comment' => '支持平台,多个以英文逗号分隔'])
->addColumn('attach', 'json', ['null' => false, 'comment' => '附件地址: $[*].url为附件地址, $[*].ext为文件格式, $[*].btn_name为下载按钮名称'])
->addColumn('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序'])
->addColumn('recommend', 'boolean', ['null' => false, 'default' => 0, 'comment' => '是否推荐:1是,0否'])
->addColumn('seo_title', 'string', ['limit' => 255, 'default' => null, 'comment' => 'SEO标题'])
->addColumn('seo_keywords', 'string', ['limit' => 255, 'default' => null, 'comment' => 'SEO关键字'])
->addColumn('seo_desc', 'string', ['limit' => 255, 'default' => null, 'comment' => 'SEO描述'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addColumn('updated_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'update' => 'CURRENT_TIMESTAMP', 'comment' => '更新时间'])
->addColumn('deleted_at', 'timestamp', ['null' => true, 'comment' => '删除时间'])
->create();
}
}

View File

@@ -0,0 +1,40 @@
<?php
use think\migration\Migrator;
class CreateAttachmentCategory extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('attachment_category', ['engine' => 'MyISAM', 'comment' => '附件分类表']);
$table->addColumn('language_id', 'integer', ['signed' => false , 'null' => false, 'comment' => '语言ID'])
->addColumn('name', 'string', ['limit' => 64 , 'null' => false, 'comment' => '分类名称'])
->addColumn('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序'])
->addColumn('is_show', 'boolean', ['null' => false, 'default' => 1, 'comment' => '是否显示:1是,0否'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addColumn('updated_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'update' => 'CURRENT_TIMESTAMP', 'comment' => '更新时间'])
->addColumn('deleted_at', 'timestamp', ['null' => true, 'comment' => '删除时间'])
->create();
}
}

View File

@@ -0,0 +1,42 @@
<?php
use think\migration\Migrator;
class CreateFaq extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('faq', ['engine' => 'MyISAM', 'comment' => '常见问题表']);
$table->addColumn('language_id', 'integer', ['signed' => false , 'null' => false, 'comment' => '语言ID'])
->addColumn('image', 'string', ['limit' => 125, 'null' => true, 'default' => null, 'comment' => '图片地址'])
->addColumn('question', 'string', ['limit' => 255, 'null' => false, 'comment' => '问题内容'])
->addColumn('answer', 'text', ['null' => true, 'default' => null, 'comment' => '回答内容'])
->addColumn('recommend', 'boolean', ['null' => false, 'default' => 0, 'comment' => '是否推荐:1是,0否'])
->addColumn('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addColumn('updated_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'update' => 'CURRENT_TIMESTAMP', 'comment' => '更新时间'])
->addColumn('deleted_at', 'timestamp', ['null' => true, 'comment' => '删除时间'])
->create();
}
}

View File

@@ -0,0 +1,40 @@
<?php
use think\migration\Migrator;
class CreateContactUs extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('contact_us', ['engine' => 'MyISAM', 'comment' => '联系我们表']);
$table->addColumn('language_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '语言ID'])
->addColumn('name', 'string', ['limit' => 64, 'null' => false, 'comment' => '姓名'])
->addColumn('email', 'string', ['limit' => 128, 'null' => false, 'comment' => '邮箱'])
->addColumn('content', 'text', ['null' => false, 'comment' => '内容'])
->addColumn('ip', 'string', ['limit' => 64, 'null' => false, 'comment' => 'IP'])
->addColumn('user_agent', 'string', ['limit' => 255, 'null' => false, 'comment' => 'UserAgent'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->create();
}
}

View File

@@ -0,0 +1,47 @@
<?php
use think\migration\Migrator;
class CreateBulkPurchaseInquiry extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('bulk_purchase_inquiry', ['engine' => 'MyISAM', 'comment' => '批量采购询盘表']);
$table->addColumn('language_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '语言ID'])
->addColumn('corp_name', 'string', ['limit' => 64, 'null' => false, 'comment' => '公司名称'])
->addColumn('first_name', 'string', ['limit' => 64, 'null' => false, 'comment' => '姓'])
->addColumn('last_name', 'string', ['limit' => 64, 'null' => false, 'comment' => '名'])
->addColumn('email', 'string', ['limit' => 128, 'null' => false, 'comment' => '邮箱'])
->addColumn('phone', 'string', ['limit' => 32, 'null' => false, 'comment' => '电话'])
->addColumn('province', 'string', ['limit' => 64, 'null' => false, 'comment' => '省'])
->addColumn('city', 'string', ['limit' => 64, 'null' => false, 'comment' => '市'])
->addColumn('district', 'string', ['limit' => 64, 'null' => false, 'comment' => '区'])
->addColumn('address', 'string', ['limit' => 255, 'null' => false, 'comment' => '地址'])
->addColumn('interest', 'string', ['limit' => 255, 'null' => false, 'comment' => '兴趣(感兴趣的产品品类)'])
->addColumn('message', 'text', ['null' => false, 'comment' => '留言内容'])
->addColumn('ip', 'string', ['limit' => 64, 'null' => false, 'comment' => 'IP'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->create();
}
}

View File

@@ -0,0 +1,46 @@
<?php
use think\migration\Migrator;
class CreateAgent extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('agent', ['engine' => 'MyISAM', 'comment' => '代理商表']);
$table->addColumn('language_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '语言ID'])
->addColumn('corp_name', 'string', ['limit' => 64, 'null' => false, 'comment' => '公司名称'])
->addColumn('email', 'string', ['limit' => 64, 'null' => false, 'comment' => '邮箱'])
->addColumn('phone', 'string', ['limit' => 64, 'null' => false, 'comment' => '电话'])
->addColumn('website_url', 'string', ['limit' => 128, 'null' => false, 'comment' => '网站地址'])
->addColumn('business_type', 'integer', ['null' => false, 'comment' => '业务类型'])
->addColumn('enterprise_size', 'integer', ['null' => false, 'comment' => '企业规模'])
->addColumn('province', 'string', ['limit' => 64, 'null' => true, 'default' => null, 'comment' => '省'])
->addColumn('city', 'string', ['limit' => 64, 'null' => true, 'default' => null, 'comment' => '市'])
->addColumn('district', 'string', ['limit' => 64, 'null' => true, 'default' => null, 'comment' => '区/县'])
->addColumn('address', 'string', ['limit' => 255, 'null' => true, 'default' => null, 'comment' => '地址'])
->addColumn('message', 'text', ['null' => true, 'default' => null, 'comment' => '留言'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->create();
}
}

View File

@@ -0,0 +1,38 @@
<?php
use think\migration\Migrator;
class CreateAgentBusinessType extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('agent_business_type', ['engine' => 'MyISAM', 'comment' => '代理商业务类型表']);
$table->addColumn('cn_name', 'string', ['limit' => 64, 'null' => false, 'comment' => '业务类型名称'])
->addColumn('en_name', 'string', ['limit' => 128, 'null' => false, 'comment' => '英文名称'])
->addColumn('desc', 'string', ['limit' => 255, 'null' => true, 'default' => null, 'comment' => '业务类型描述'])
->addColumn('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->create();
}
}

View File

@@ -0,0 +1,38 @@
<?php
use think\migration\Migrator;
class CreateAgentEntrypriceSizeType extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('agent_entryprice_size_type', ['engine' => 'MyISAM', 'comment' => '代理商企业规模类型表']);
$table->addColumn('cn_name', 'integer', ['signed' => false, 'null' => false, 'comment' => '中文类型名'])
->addColumn('en_name', 'integer', ['signed' => false, 'null' => false, 'comment' => '英文类型名'])
->addColumn('desc', 'string', ['limit' => 255, 'null' => true, 'default' => null, 'comment' => '描述信息'])
->addColumn('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->create();
}
}

View File

@@ -0,0 +1,43 @@
<?php
use think\migration\Migrator;
class CreateProductInquiry extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('product_inquiry', ['engine' => 'MyISAM', 'comment' => '产品询盘表']);
$table->addColumn('language_id', 'integer', ['null' => false, 'comment' => '语言ID'])
->addColumn('corp_name', 'string', ['limit' => 128, 'null' => false, 'comment' => '公司名称'])
->addColumn('first_name', 'string', ['limit' => 64, 'null' => false, 'comment' => '姓'])
->addColumn('last_name', 'string', ['limit' => 64, 'null' => false, 'comment' => '名'])
->addColumn('email', 'string', ['limit' => 128, 'null' => false, 'comment' => '邮箱'])
->addColumn('phone', 'string', ['limit' => 64, 'null' => true, 'default' => null, 'comment' => '电话'])
->addColumn('country_name', 'string', ['limit' => 128, 'null' => true, 'default' => null, 'comment' => '所在国家名称'])
->addColumn('industry', 'string', ['limit' => 64, 'null' => true, 'default' => null, 'comment' => '所属行业'])
->addColumn('message', 'text', ['null' => true, 'default' => null, 'comment' => '留言内容'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->create();
}
}