debug
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class AddGgPaiXuColumOnGuangGaoTable extends Migrator
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$Table = $this->table('guang_gao');
|
||||
|
||||
$Table->addColumn('gg_sort', 'integer', ['after' => 'gg_tiao_zhuan_di_zhi'])->setComment("排序")->save();
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$Table = $this->table('guang_gao');
|
||||
$Table->removeColumn('gg_sort')->save();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class SeoKeywordsTable extends Migrator
|
||||
{
|
||||
public function change()
|
||||
{
|
||||
// 创建 seo_keywords 表
|
||||
$table = $this->table('seo_keywords', [
|
||||
'id' => 'sw_id' // 这里指定 sw_id 作为自增主键
|
||||
]);
|
||||
|
||||
// 添加 sw_title 字段,类型为字符串
|
||||
$table->addColumn('sw_title', 'string', [
|
||||
'limit' => 255,
|
||||
'null' => false,
|
||||
'comment' => '关键词标题'
|
||||
]);
|
||||
|
||||
// 添加 sw_status 字段,类型为布尔值或整数
|
||||
$table->addColumn('sw_status', 'boolean', [
|
||||
'default' => 0,
|
||||
'null' => false,
|
||||
'comment' => '关键词状态,1表示启用,0表示禁用'
|
||||
]);
|
||||
|
||||
// 添加 sw_html_path 字段,类型为字符串
|
||||
$table->addColumn('sw_html_path', 'string', [
|
||||
'limit' => 255,
|
||||
'null' => true,
|
||||
'comment' => '关键词关联的HTML路径'
|
||||
]);
|
||||
|
||||
// 为 sw_html_path 字段添加索引
|
||||
$table->addIndex(['sw_html_path'], [
|
||||
'unique' => false, // 如果你希望索引是唯一的,设置为 true
|
||||
'name' => 'idx_sw_html_path' // 索引名称,可以省略,系统会自动生成
|
||||
]);
|
||||
|
||||
// 创建表
|
||||
$table->create();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class GuanggaoAddStatus extends Migrator
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$Table = $this->table('guang_gao');
|
||||
|
||||
$Table->addColumn('gg_status', 'integer', ['after' => 'gg_tiao_zhuan_di_zhi', 'default' => 0])->setComment("状态")->save();
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$Table = $this->table('guang_gao');
|
||||
$Table->removeColumn('gg_status')->save();
|
||||
}
|
||||
}
|
||||
65
code/database/migrations/20250104155836_video_class.php
Normal file
65
code/database/migrations/20250104155836_video_class.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class VideoClass 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()
|
||||
{
|
||||
// 创建 seo_keywords 表
|
||||
$table = $this->table('video_class', [
|
||||
'id' => 'vc_id' // 这里指定 sw_id 作为自增主键
|
||||
]);
|
||||
|
||||
// 添加 vc_name 字段,类型为字符串
|
||||
$table->addColumn('vc_name', 'string', [
|
||||
'limit' => 255,
|
||||
'null' => false,
|
||||
'comment' => '分类名称'
|
||||
]);
|
||||
// 添加 vc_name 字段,类型为字符串
|
||||
$table->addColumn('vc_nicheng', 'string', [
|
||||
'limit' => 255,
|
||||
'null' => false,
|
||||
'comment' => '分类昵称'
|
||||
]);
|
||||
|
||||
$table->addColumn('vc_sort', 'integer', [
|
||||
'limit' => 255,
|
||||
'default'=>0,
|
||||
'comment' => '排序'
|
||||
]);
|
||||
// 添加 vc_status 字段,类型为布尔值或整数
|
||||
$table->addColumn('vc_status', 'boolean', [
|
||||
'default' => 1,
|
||||
'null' => false,
|
||||
'comment' => '关键词状态,1表示启用,0表示禁用'
|
||||
]);
|
||||
|
||||
|
||||
// 创建表
|
||||
$table->create();
|
||||
}
|
||||
}
|
||||
65
code/database/migrations/20250104160751_video_leixin.php
Normal file
65
code/database/migrations/20250104160751_video_leixin.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class VideoLeixin 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()
|
||||
{
|
||||
// 创建 seo_keywords 表
|
||||
$table = $this->table('video_leixin', [
|
||||
'id' => 'vl_id' // 这里指定 sw_id 作为自增主键
|
||||
]);
|
||||
|
||||
// 添加 vc_id 字段,
|
||||
$table->addColumn('vc_id', 'integer', [
|
||||
'limit' => 11,
|
||||
'null' => false,
|
||||
'comment' => '分类id'
|
||||
]);
|
||||
|
||||
// 添加 vl_name 字段,类型为字符串
|
||||
$table->addColumn('vl_name', 'string', [
|
||||
'limit' => 255,
|
||||
'null' => false,
|
||||
'comment' => '类型名称'
|
||||
]);
|
||||
// 添加 vp_sort 字段,
|
||||
$table->addColumn('vl_sort', 'integer', [
|
||||
'default'=>0,
|
||||
'comment' => '排序'
|
||||
]);
|
||||
|
||||
// 添加 vc_status 字段,类型为布尔值或整数
|
||||
$table->addColumn('vl_status', 'boolean', [
|
||||
'default' => 1,
|
||||
'null' => false,
|
||||
'comment' => '关键词状态,1表示启用,0表示禁用'
|
||||
]);
|
||||
|
||||
// 创建表
|
||||
$table->create();
|
||||
}
|
||||
}
|
||||
58
code/database/migrations/20250104161057_video_juqing.php
Normal file
58
code/database/migrations/20250104161057_video_juqing.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class VideoJuqing 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()
|
||||
{
|
||||
// 创建 seo_keywords 表
|
||||
$table = $this->table('video_juqing', [
|
||||
'id' => 'vj_id' // 这里指定 sw_id 作为自增主键
|
||||
]);
|
||||
|
||||
// 添加 vc_id 字段,
|
||||
$table->addColumn('vc_id', 'integer', [
|
||||
'limit' => 11,
|
||||
'null' => false,
|
||||
'comment' => '分类id'
|
||||
]);
|
||||
|
||||
// 添加 vl_name 字段,类型为字符串
|
||||
$table->addColumn('vj_name', 'string', [
|
||||
'limit' => 255,
|
||||
'null' => false,
|
||||
'comment' => '剧情名称'
|
||||
]);
|
||||
// 添加 vp_sort 字段,
|
||||
$table->addColumn('vj_sort', 'integer', [
|
||||
'default'=>0,
|
||||
'comment' => '排序'
|
||||
]);
|
||||
|
||||
// 创建表
|
||||
$table->create();
|
||||
}
|
||||
}
|
||||
59
code/database/migrations/20250104161633_video_diqu.php
Normal file
59
code/database/migrations/20250104161633_video_diqu.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class VideoDiqu 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()
|
||||
{
|
||||
// 创建 seo_keywords 表
|
||||
$table = $this->table('video_diqu', [
|
||||
'id' => 'vd_id' // 这里指定 sw_id 作为自增主键
|
||||
]);
|
||||
|
||||
// 添加 vc_id 字段,
|
||||
$table->addColumn('vc_id', 'integer', [
|
||||
'limit' => 11,
|
||||
'null' => false,
|
||||
'comment' => '分类id'
|
||||
]);
|
||||
|
||||
// 添加 vl_name 字段,类型为字符串
|
||||
$table->addColumn('vd_name', 'string', [
|
||||
'limit' => 255,
|
||||
'null' => false,
|
||||
'comment' => '地区名称'
|
||||
]);
|
||||
// 添加 vp_sort 字段,
|
||||
$table->addColumn('vd_sort', 'integer', [
|
||||
'limit' => 255,
|
||||
'default'=>0,
|
||||
'comment' => '排序'
|
||||
]);
|
||||
|
||||
// 创建表
|
||||
$table->create();
|
||||
}
|
||||
}
|
||||
58
code/database/migrations/20250104161642_video_years.php
Normal file
58
code/database/migrations/20250104161642_video_years.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class VideoYears 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()
|
||||
{
|
||||
// 创建 seo_keywords 表
|
||||
$table = $this->table('video_years', [
|
||||
'id' => 'vy_id' // 这里指定 sw_id 作为自增主键
|
||||
]);
|
||||
|
||||
// 添加 vc_id 字段,
|
||||
$table->addColumn('vc_id', 'integer', [
|
||||
'limit' => 11,
|
||||
'null' => false,
|
||||
'comment' => '分类id'
|
||||
]);
|
||||
|
||||
// 添加 vl_name 字段,类型为字符串
|
||||
$table->addColumn('vy_name', 'string', [
|
||||
'limit' => 255,
|
||||
'null' => false,
|
||||
'comment' => '年份名称'
|
||||
]);
|
||||
// 添加 vp_sort 字段,
|
||||
$table->addColumn('vy_sort', 'integer', [
|
||||
'limit' => 255,
|
||||
'default'=>0,
|
||||
'comment' => '排序'
|
||||
]);
|
||||
// 创建表
|
||||
$table->create();
|
||||
}
|
||||
}
|
||||
59
code/database/migrations/20250104161650_video_language.php
Normal file
59
code/database/migrations/20250104161650_video_language.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class VideoLanguage 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()
|
||||
{
|
||||
// 创建 seo_keywords 表
|
||||
$table = $this->table('video_language', [
|
||||
'id' => 'vla_id' // 这里指定 sw_id 作为自增主键
|
||||
]);
|
||||
|
||||
// 添加 vc_id 字段,
|
||||
$table->addColumn('vc_id', 'integer', [
|
||||
'limit' => 11,
|
||||
'null' => false,
|
||||
'comment' => '分类id'
|
||||
]);
|
||||
|
||||
// 添加 vl_name 字段,类型为字符串
|
||||
$table->addColumn('vla_name', 'string', [
|
||||
'limit' => 255,
|
||||
'null' => false,
|
||||
'comment' => '语言名称'
|
||||
]);
|
||||
// 添加 vp_sort 字段,
|
||||
$table->addColumn('vla_sort', 'integer', [
|
||||
'limit' => 255,
|
||||
'default'=>0,
|
||||
'comment' => '排序'
|
||||
]);
|
||||
|
||||
// 创建表
|
||||
$table->create();
|
||||
}
|
||||
}
|
||||
91
code/database/migrations/20250104162037_video_info.php
Normal file
91
code/database/migrations/20250104162037_video_info.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class VideoInfo 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()
|
||||
{
|
||||
// 创建 video_info 表
|
||||
$table = $this->table('video_info', [
|
||||
'id' => 'v_id' // 这里指定 v_id 作为自增主键
|
||||
]);
|
||||
$table->addColumn('v_name', 'string', ['limit' => 255,'null' => false,'comment' => '名称']);
|
||||
$table->addColumn('v_cover', 'json', ['default' => null, 'null' => true, 'comment' => '封面']);
|
||||
|
||||
$table->addColumn('vc_id', 'integer', ['comment' => '视频分类id:1电影,2电视剧,3综艺,4动漫']);
|
||||
|
||||
$table->addColumn('v_pinyin', 'string', ['limit' => 255,'comment' => '[拼音id]']);
|
||||
$table->addColumn('v_leixin', 'string', ['limit' => 255,'null' => true,'comment' => '类型']);
|
||||
$table->addColumn('v_juqing', 'string', ['limit' => 255,'null' => true,'comment' => '剧情']);
|
||||
$table->addColumn('v_diqu', 'string', ['limit' => 255,'null' => true,'comment' => '地区']);
|
||||
$table->addColumn('v_years', 'string', ['limit' => 255,'null' => true,'comment' => '年份']);
|
||||
$table->addColumn('v_language', 'string', ['limit' => 255,'null' => true,'comment' => '语言']);
|
||||
|
||||
$table->addColumn('v_daoyan', 'string', ['limit' => 255,'null' => true,'comment' => '导演']);
|
||||
$table->addColumn('v_zhuyan', 'string', ['limit' => 255,'null' => true,'comment' => '主演']);
|
||||
$table->addColumn('v_orurl', 'string', ['limit' => 255,'comment' => '来源url']);
|
||||
$table->addColumn('v_md5', 'string', ['limit' => 255,'comment' => 'md5:vc_id+v_name+v_orurl']);
|
||||
$table->addColumn('v_jiaobiao', 'string', ['limit' => 255,'null' => true,'comment' => '角标']);
|
||||
|
||||
$table->addColumn('v_description', 'text', ['comment' => '简介']);
|
||||
|
||||
$table->addColumn('v_pingfen', 'decimal', ['precision' => 10, 'scale' => 2, 'default' => 0, 'comment' => '评分']);
|
||||
$table->addColumn('v_status', 'boolean',array('limit' => 1,'default'=>0,'comment'=>'状态:0:正常,1:异常'));
|
||||
|
||||
$table->addColumn('v_click', 'integer', ['default'=>0,'comment' => '点击数']);
|
||||
$table->addColumn('v_recommend', 'integer', ['default'=>0,'comment' => '推荐等级']);
|
||||
|
||||
|
||||
$table->addColumn('update_time', 'datetime', ['null' => true, 'comment' => '更新时间']);
|
||||
$table->addColumn('create_time', 'datetime', ['null' => true, 'comment' => '创建时间']);
|
||||
|
||||
$table->addIndex('vc_id');
|
||||
$table->addIndex('v_md5');
|
||||
$table->addIndex('v_pinyin');
|
||||
$table->addIndex('v_status');
|
||||
// 添加复合索引 idx_vc_id_pingfen
|
||||
$table->addIndex(['vc_id', 'v_pingfen'], [
|
||||
'name' => 'idx_vc_id_pingfen',
|
||||
'unique' => false
|
||||
]);
|
||||
|
||||
// 添加复合索引 idx_vc_id_v_click
|
||||
$table->addIndex(['vc_id', 'v_click'], [
|
||||
'name' => 'idx_vc_id_v_click',
|
||||
'unique' => false
|
||||
]);
|
||||
|
||||
// 创建表
|
||||
$table->create();
|
||||
|
||||
|
||||
// $table->string('head_title',100)->default('')->comment('seo-标题');
|
||||
// $table->string('head_keyword',200)->default('')->comment('seo-关键词');
|
||||
// $table->string('head_description',255)->default('')->comment('seo-描述');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
68
code/database/migrations/20250104162430_video_playurl.php
Normal file
68
code/database/migrations/20250104162430_video_playurl.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class VideoPlayurl 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()
|
||||
{
|
||||
// 创建 seo_keywords 表
|
||||
$table = $this->table('video_playurl', [
|
||||
'id' => 'vp_id' // 这里指定 vp_id 作为自增主键
|
||||
]);
|
||||
|
||||
// 添加 v_id 字段,
|
||||
$table->addColumn('v_id', 'integer', [
|
||||
'comment' => '视频id'
|
||||
]);
|
||||
|
||||
// 添加 vp_sort 字段,
|
||||
$table->addColumn('vp_sort', 'integer', [
|
||||
'default'=>0,
|
||||
'comment' => '线路排序'
|
||||
]);
|
||||
|
||||
// 添加 vp_md5 字段,
|
||||
$table->addColumn('vp_md5', 'string', [
|
||||
'limit' => 255,
|
||||
'comment' => 'md5:v_id+vp_url'
|
||||
]);
|
||||
|
||||
|
||||
// 添加 vp_name 字段,类型为字符串
|
||||
$table->addColumn('vp_name', 'string', [
|
||||
'limit' => 255,
|
||||
'null' => false,
|
||||
'comment' => '线路名称'
|
||||
]);
|
||||
|
||||
$table->addColumn('vp_url', 'json', [ 'null' => false, 'comment' => '播放地址']);
|
||||
$table->addIndex('v_id');
|
||||
$table->addIndex('vp_md5');
|
||||
|
||||
// 创建表
|
||||
$table->create();
|
||||
}
|
||||
}
|
||||
62
code/database/migrations/20250105042300_gan_rao_ma.php
Normal file
62
code/database/migrations/20250105042300_gan_rao_ma.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class GanRaoMa 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()
|
||||
{
|
||||
// 创建 gan_rao_ma 表
|
||||
$table = $this->table('gan_rao_ma', [
|
||||
'id' => 'grm_id' // 这里指定 grm_id 作为自增主键
|
||||
]);
|
||||
|
||||
// 添加 grm_neirong 字段,类型为字符串
|
||||
$table->addColumn('grm_neirong', 'text', [
|
||||
'null' => false,
|
||||
'comment' => '干扰码内容'
|
||||
]);
|
||||
|
||||
// 添加 grm_status 字段,类型为布尔值或整数
|
||||
$table->addColumn('grm_status', 'boolean', [
|
||||
'default' => 0,
|
||||
'null' => false,
|
||||
'comment' => '干扰码状态,1表示启用,0表示禁用'
|
||||
]);
|
||||
|
||||
// 添加 grm_html_path 字段,类型为字符串
|
||||
$table->addColumn('grm_html_path', 'string', [
|
||||
'limit' => 255,
|
||||
'null' => true,
|
||||
'comment' => '干扰码关联的HTML路径'
|
||||
]);
|
||||
|
||||
// 为 grm_html_path 字段添加索引
|
||||
$table->addIndex('grm_html_path');
|
||||
|
||||
// 创建表
|
||||
$table->create();
|
||||
}
|
||||
}
|
||||
48
code/database/migrations/20250108092206_seo_tdk_config.php
Normal file
48
code/database/migrations/20250108092206_seo_tdk_config.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class SeoTdkConfig 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()
|
||||
{
|
||||
// 创建 seo_tdk_config 表
|
||||
$table = $this->table('seo_tdk_config', [
|
||||
'id' => 'stc_id' // 这里指定 stc_id 作为自增主键
|
||||
]);
|
||||
$table->addColumn('stc_code', 'string', ['limit' => 255,'null' => false,'comment' => '编码标识']);
|
||||
$table->addColumn('stc_name', 'string', ['limit' => 255,'null' => true,'comment' => '页面名称']);
|
||||
$table->addColumn('stc_title', 'string', ['limit' => 255,'null' => true,'comment' => '页面标题']);
|
||||
$table->addColumn('stc_keywords', 'string', ['limit' => 255,'null' => true,'comment' => '页面关键词']);
|
||||
$table->addColumn('stc_description', 'string', ['limit' => 255,'null' => true,'comment' => '页面描述']);
|
||||
$table->addColumn('stc_other_conf', 'string', ['limit' => 255,'null' => true,'comment' => '其它配置']);
|
||||
$table->addColumn('stc_tongji_daima', 'string', ['limit' => 255,'null' => true,'comment' => '页面统计代码']);
|
||||
$table->addColumn('stc_status', 'boolean',array('limit' => 1,'default'=>0,'comment'=>'状态:0:正常,1:异常'));
|
||||
$table->addIndex('stc_code');
|
||||
|
||||
// 创建表
|
||||
$table->create();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class CreateVisitLogs 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()
|
||||
{
|
||||
// 创建 visit_logs 表
|
||||
$visitLogsTable = $this->table('visit_logs', [
|
||||
'id' => 'vil_id' // 这里指定 stc_id 作为自增主键
|
||||
]);
|
||||
|
||||
$visitLogsTable->addColumn('vil_ip', 'string', ['limit' => 45, 'null' => false, 'comment' => '访问者 IP 地址'])
|
||||
->addColumn('vil_url', 'text', ['null' => false, 'comment' => '访问的 URL'])
|
||||
->addColumn('vil_method', 'string', ['limit' => 10, 'null' => false, 'comment' => 'HTTP 方法'])
|
||||
->addColumn('vil_content_type', 'enum', ['values' => ['video', 'novel', 'page'], 'null' => false, 'comment' => '内容类型(视频、小说、页面)'])
|
||||
->addColumn('vil_content_id', 'string', ['default' => '','null' => false, 'comment' => '内容 ID(视频、小说或页面的唯一标识)'])
|
||||
|
||||
->addColumn('vil_user_agent', 'text', ['null' => true, 'comment' => 'User-Agent 信息'])
|
||||
->addColumn('vil_headers', 'text', ['null' => true, 'comment' => '请求头信息'])
|
||||
->addColumn('vil_is_spider', 'boolean', ['default' => 0, 'comment' => '是否为爬虫:0-否,1-是'])
|
||||
->addColumn('vil_location', 'text', ['null' => true, 'comment' => '地理位置'])
|
||||
->addColumn('vil_user_id', 'biginteger', ['null' => true, 'comment' => '用户 ID(可选)'])
|
||||
->addColumn('vil_timestamp', 'datetime', ['null' => true,'default' => 'CURRENT_TIMESTAMP', 'comment' => '访问时间'])
|
||||
// 添加索引
|
||||
->addIndex(['vil_content_type', 'vil_content_id'], ['name' => 'idx_content_type_id'])
|
||||
->addIndex('vil_timestamp', ['name' => 'idx_timestamp'])
|
||||
->addIndex('vil_is_spider', ['name' => 'idx_is_spider'])
|
||||
->addIndex('vil_user_id', ['name' => 'idx_user_id'])
|
||||
->addIndex('vil_ip', ['name' => 'idx_ip'])
|
||||
->create();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class CreateContentStats 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()
|
||||
{
|
||||
|
||||
// 创建 content_stats 表
|
||||
$table = $this->table('content_stats', [
|
||||
'id' => 'cs_id' // 这里指定 stc_id 作为自增主键
|
||||
]);
|
||||
|
||||
|
||||
$table->addColumn('cs_content_type', 'enum', [
|
||||
'values' => ['video', 'novel', 'page'], // 扩展支持页面
|
||||
'null' => false,
|
||||
'comment' => '内容类型(视频、小说、页面)'
|
||||
])
|
||||
->addColumn('cs_content_id', 'string', [
|
||||
'null' => false,
|
||||
'comment' => '内容 ID(视频、小说或页面 ID)'
|
||||
])
|
||||
->addColumn('cs_stat_date', 'string', [
|
||||
'null' => false,
|
||||
'comment' => '统计日期'
|
||||
])
|
||||
->addColumn('cs_stat_period', 'enum', [
|
||||
'values' => ['day', 'week', 'month', 'quarter', 'year'],
|
||||
'null' => false,
|
||||
'comment' => '统计周期'
|
||||
])
|
||||
->addColumn('cs_pv', 'integer', [
|
||||
'null' => false,
|
||||
'default' => 0,
|
||||
'comment' => '页面浏览量(PV)'
|
||||
])
|
||||
->addColumn('cs_uv', 'integer', [
|
||||
'null' => false,
|
||||
'default' => 0,
|
||||
'comment' => '独立访客量(UV)'
|
||||
])
|
||||
->addColumn('updated_at', 'timestamp', [
|
||||
'default' => 'CURRENT_TIMESTAMP',
|
||||
'update' => 'CURRENT_TIMESTAMP',
|
||||
'comment' => '更新时间'
|
||||
])
|
||||
->addColumn('cs_md5', 'string', [
|
||||
'default' => '',
|
||||
'null' => false,
|
||||
'comment' => 'md5(cs_content_type+cs_content_id+cs_stat_date+cs_stat_period'
|
||||
])
|
||||
// 添加索引
|
||||
->addIndex('cs_content_type', ['name' => 'cs_content_type'])
|
||||
->addIndex('cs_content_id', ['name' => 'cs_content_id'])
|
||||
->addIndex('cs_stat_date', ['name' => 'cs_stat_date'])
|
||||
->addIndex('cs_stat_period', ['name' => 'cs_stat_period'])
|
||||
->addIndex(['cs_md5'], [
|
||||
'unique' => true,
|
||||
'name' => 'unique_cs_md5'
|
||||
])
|
||||
->create();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class AddNewColumnToVideoInfo 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_info');
|
||||
|
||||
// 添加 "影院售票总额" 字段
|
||||
$table->addColumn('v_ticket_sales', 'decimal', [
|
||||
'precision' => 12, // 最大 9999999999.99
|
||||
'scale' => 2, // 保留两位小数
|
||||
'default' => 0.00, // 默认值 0.00
|
||||
'comment' => '影院售票总额(单位:亿元)'
|
||||
])->update();
|
||||
}
|
||||
}
|
||||
48
code/database/migrations/20250215153113_seo_html.php
Normal file
48
code/database/migrations/20250215153113_seo_html.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class SeoHtml 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()
|
||||
{
|
||||
// 创建 video_info 表
|
||||
$table = $this->table('seo_html', [
|
||||
'id' => 'sh_id' // 这里指定 v_id 作为自增主键
|
||||
]);
|
||||
$table->addColumn('sh_title', 'string', ['limit' => 255,'null' => false,'comment' => 'title']);
|
||||
$table->addColumn('sh_keywords', 'string', ['limit' => 255,'null' => false,'comment' => 'keywords']);
|
||||
$table->addColumn('sh_description', 'text', ['comment' => '简介']);
|
||||
$table->addColumn('sh_body', 'text', ['comment' => '内容']);
|
||||
$table->addColumn('sh_click', 'integer', ['default'=>0,'comment' => '点击数']);
|
||||
$table->addColumn('sh_html_path', 'string', ['limit' => 255, 'null' => true,'comment' => 'HTML源文件路径']);
|
||||
$table->addColumn('update_time', 'datetime', ['null' => true, 'comment' => '更新时间']);
|
||||
$table->addColumn('create_time', 'datetime', ['null' => true, 'comment' => '创建时间']);
|
||||
$table->addIndex('sh_html_path');
|
||||
|
||||
// 创建表
|
||||
$table->create();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class CreateXiaoShuoXiangQingSeo 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()
|
||||
{
|
||||
// 创建 video_info 表
|
||||
$table = $this->table('novel_info_seo', [
|
||||
'id' => 'nis_id' // 这里指定 v_id 作为自增主键
|
||||
]);
|
||||
$table->addColumn('nis_name', 'string', ['limit' => 255,'null' => false,'comment' => '名称']);
|
||||
|
||||
$table->addColumn('nis_jie_shao', 'text', ['comment' => '介绍']);
|
||||
|
||||
$table->addColumn('xsxq_id', 'integer', ['comment' => '小说详情id']);
|
||||
|
||||
$table->addColumn('nis_status', 'boolean',array('limit' => 1,'default'=>0,'comment'=>'状态:0:正常,1:异常'));
|
||||
|
||||
$table->addColumn('nis_click', 'integer', ['default'=>0,'comment' => '点击数']);
|
||||
|
||||
$table->addColumn('nis_md5', 'string', ['limit' => 255,'comment' => 'md5:xsxq_id+nis_name']);
|
||||
|
||||
$table->addIndex('xsxq_id');
|
||||
$table->addIndex('nis_md5');
|
||||
|
||||
// 创建表
|
||||
$table->create();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class AddNewColumnToXiaoShuoZhangJie 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('xiao_shuo_zhang_jie');
|
||||
|
||||
// 添加 "章节索引" 字段
|
||||
$table->addColumn('xszj_sort', 'integer', [
|
||||
'default' => 1,
|
||||
'comment' => '章节索引'
|
||||
]);
|
||||
|
||||
// 修改字段 "xszj_ming_zi",使其不能为空
|
||||
$table->changeColumn('xszj_ming_zi', 'string', [
|
||||
'null' => false, // 设置字段为 NOT NULL
|
||||
'comment' => '章节名称'
|
||||
]);
|
||||
|
||||
// 添加 "xszj_source_code" 字段并设置为唯一
|
||||
// $table->addColumn('xszj_source_code', 'string', [
|
||||
// 'null' => false,
|
||||
// 'comment' => '来源代码'
|
||||
// ]);
|
||||
|
||||
// 为 "xszj_source_code" 添加唯一索引,确保其值唯一
|
||||
//$table->addIndex(['xszj_source_code'], ['unique' => true]);
|
||||
|
||||
$table->update();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class CreateVideoInfoSeo 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()
|
||||
{
|
||||
// 创建 video_info 表
|
||||
$table = $this->table('video_info_seo', [
|
||||
'id' => 'vis_id' // 这里指定 v_id 作为自增主键
|
||||
]);
|
||||
$table->addColumn('vis_name', 'string', ['limit' => 255,'null' => false,'comment' => '名称']);
|
||||
|
||||
$table->addColumn('vis_jie_shao', 'text', ['comment' => '介绍']);
|
||||
|
||||
$table->addColumn('v_id', 'integer', ['comment' => '详情id']);
|
||||
|
||||
$table->addColumn('vis_status', 'boolean',array('limit' => 1,'default'=>0,'comment'=>'状态:0:正常,1:异常'));
|
||||
|
||||
$table->addColumn('vis_click', 'integer', ['default'=>0,'comment' => '点击数']);
|
||||
|
||||
$table->addColumn('vis_md5', 'string', ['limit' => 255,'comment' => 'md5:v_id+vis_name']);
|
||||
|
||||
$table->addIndex('v_id');
|
||||
$table->addIndex('vis_md5');
|
||||
|
||||
// 创建表
|
||||
$table->create();
|
||||
|
||||
}
|
||||
}
|
||||
56
code/database/migrations/20250223165052_create_site.php
Normal file
56
code/database/migrations/20250223165052_create_site.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class CreateSite 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()
|
||||
{
|
||||
// 创建 video_info 表
|
||||
$table = $this->table('site', [
|
||||
'id' => 'site_id' // 这里指定 v_id 作为自增主键
|
||||
]);
|
||||
$table->addColumn('site_name', 'string', ['limit' => 255,'null' => false,'comment' => '名称']);
|
||||
$table->addColumn('site_type', 'string', ['limit' => 255,'null' => false,'comment' => '站点类型:novel.video']);
|
||||
$table->addColumn('site_log_type', 'string', ['limit' => 255,'null' => false,'comment' => 'logo类型 1:图片,2:文字']);
|
||||
$table->addColumn('site_email', 'string', ['limit' => 255,'null' => false,'comment' => '邮箱']);
|
||||
$table->addColumn('site_telegram', 'string', ['limit' => 255,'null' => false,'comment' => 'Telegram']);
|
||||
$table->addColumn('site_domain', 'string', ['limit' => 255,'null' => false,'comment' => '域名']);
|
||||
$table->addColumn('site_share_domain', 'string', ['limit' => 255,'null' => false,'comment' => '分享域名']);
|
||||
$table->addColumn('site_version', 'string', ['limit' => 255,'null' => false,'comment' => '版本号']);
|
||||
$table->addColumn('site_fenlei_path', 'string', ['limit' => 255,'null' => true,'comment' => '分类路由目录']);
|
||||
$table->addColumn('site_xiangqing_path', 'string', ['limit' => 255,'null' => true,'comment' => '详情路由目录']);
|
||||
$table->addColumn('site_zhangjie_path', 'string', ['limit' => 255,'null' => true,'comment' => '章节路由目录']);
|
||||
$table->addColumn('site_rank_path', 'string', ['limit' => 255,'null' => true,'comment' => '排行榜路由目录']);
|
||||
$table->addColumn('site_tui_jian_path', 'string', ['limit' => 255,'null' => true,'comment' => '推荐路由目录']);
|
||||
$table->addColumn('site_seo_path', 'string', ['limit' => 255,'null' => true,'comment' => '详情seo词路由目录']);
|
||||
$table->addColumn('site_zdy_path', 'string', ['limit' => 255,'null' => true,'comment' => '自定义seo页面路由目录']);
|
||||
$table->addColumn('site_tongji', 'text', ['comment' => '统计']);
|
||||
$table->addColumn('site_status', 'boolean',array('limit' => 1,'default'=>0,'comment'=>'状态:0:正常,1:异常'));
|
||||
|
||||
// 创建表
|
||||
$table->create();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class AddCloumaToAllTableAddSite 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()
|
||||
{
|
||||
// 需要添加 `site_id` 的表 gan_rao_ma guang_gao guang_gao_pei_zhi guang_gao_fen_zu plan_task seo_tdk_config system_config video_class visit_logs content_stats xiao_shuo_fen_lei
|
||||
$tables = ['gan_rao_ma', 'guang_gao', 'guang_gao_pei_zhi', 'guang_gao_fen_zu', 'plan_task', 'seo_tdk_config', 'system_config', 'video_class', 'visit_logs', 'content_stats', 'xiao_shuo_fen_lei']; // 这里填写你的表名
|
||||
|
||||
foreach ($tables as $table) {
|
||||
if ($this->hasTable($table)) {
|
||||
$tableObject = $this->table($table);
|
||||
|
||||
// 检查是否已经有 site_id 字段
|
||||
if (!$tableObject->hasColumn('site_id')) {
|
||||
$tableObject->addColumn('site_id', 'integer', [
|
||||
'default' => 1,
|
||||
'comment' => '站点ID'
|
||||
]);
|
||||
}
|
||||
|
||||
// 添加索引(避免重复添加索引)
|
||||
if (!$tableObject->hasIndex(['site_id'])) {
|
||||
$tableObject->addIndex(['site_id']);
|
||||
}
|
||||
|
||||
$tableObject->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class AddCloumnToXiaoShuoFenLei extends Migrator
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$Table = $this->table('xiao_shuo_fen_lei');
|
||||
if (!$Table->hasColumn('xsfl_sort')) {
|
||||
$Table->addColumn('xsfl_sort', 'integer', ['after' => 'site_id'])->setComment("排序")->save();
|
||||
}
|
||||
|
||||
$Table = $this->table('video_class');
|
||||
if (!$Table->hasColumn('vc_source_id')) {
|
||||
$Table->addColumn('vc_source_id', 'integer', ['after' => 'site_id'])->setComment("资源绑定真实id")->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$Table = $this->table('xiao_shuo_fen_lei');
|
||||
if ($Table->hasColumn('xsfl_sort')) {
|
||||
$Table->removeColumn('xsfl_sort')->save();
|
||||
}
|
||||
|
||||
$Table = $this->table('video_class');
|
||||
if ($Table->hasColumn('vc_source_id')) {
|
||||
$Table->removeColumn('vc_source_id')->save();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user