12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- use yii\db\Migration;
- use yii\db\Schema;
- /**
- * Class m180110_155445_banner
- */
- class m180110_155445_banner extends Migration
- {
- /**
- * @inheritdoc
- */
- public function safeUp()
- {
- }
- /**
- * @inheritdoc
- */
- public function safeDown()
- {
- echo "m180110_155445_banner cannot be reverted.\n";
- return false;
- }
- public function up()
- {
- $tableOptions = null;
- if ($this->db->driverName === 'mysql') {
- $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="轮播图"';
- }
- $this->createTable('{{%banner}}', [
- //'name'=>Schema::TYPE_STRING.'(200) PRIMARY KEY NOT NULL',
- 'id'=>Schema::TYPE_PK,
- 'status'=>Schema::TYPE_INTEGER.'(10) UNSIGNED NOT NULL COMMENT "状态"',
- 'title'=>Schema::TYPE_STRING.'(200) NOT NULL COMMENT "标题"',
- 'primaryKey'=>Schema::TYPE_STRING.'(200) NOT NULL COMMENT "关键值"',
- 'admin_id'=>Schema::TYPE_INTEGER.'(10) UNSIGNED NOT NULL COMMENT "操作用户ID"',
- 'admin_name'=>Schema::TYPE_STRING.'(200) NOT NULL COMMENT "操作用户名"',
- 'addtime'=>Schema::TYPE_INTEGER.'(10) NOT NULL COMMENT "记录时间"',
- 'admin_ip'=>Schema::TYPE_STRING.'(200) NOT NULL COMMENT "操作用户IP"',
- 'admin_agent'=>Schema::TYPE_STRING.'(200) NOT NULL COMMENT "操作用户浏览器代理商"',
- 'title'=>Schema::TYPE_STRING.'(200) NOT NULL COMMENT "记录描述"',
- 'model'=>Schema::TYPE_STRING.'(200) NOT NULL COMMENT "操作模块(例:文章)"',
- 'type'=>Schema::TYPE_STRING.'(200) NOT NULL COMMENT "操作类型(例:添加)"',
- 'handle_id'=>Schema::TYPE_INTEGER.'(10) NOT NULL COMMENT "操作对象ID"',
- 'result'=>Schema::TYPE_TEXT.' NOT NULL COMMENT "操作结果"',
- 'describe'=>Schema::TYPE_TEXT.' NOT NULL COMMENT "备注"',
- ], $tableOptions);
- }
- public function down()
- {
- $this->dropTable('{{%admin_log}}');
- }
- }
|