m220227_143429_oauth2_client.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. use yii\db\Migration;
  3. class m220227_143429_oauth2_client extends Migration
  4. {
  5. public function up()
  6. {
  7. /* 取消外键约束 */
  8. $this->execute('SET foreign_key_checks = 0');
  9. /* 创建表 */
  10. $this->createTable('{{%oauth2_client}}', [
  11. 'id' => "int(11) unsigned NOT NULL AUTO_INCREMENT",
  12. 'merchant_id' => "int(10) unsigned NULL DEFAULT '0' COMMENT '商户id'",
  13. 'store_id' => "int(10) unsigned NULL DEFAULT '0' COMMENT '店铺ID'",
  14. 'title' => "varchar(100) NOT NULL DEFAULT '' COMMENT '标题'",
  15. 'client_id' => "varchar(64) NOT NULL COMMENT '授权ID'",
  16. 'client_secret' => "varchar(64) NOT NULL COMMENT '授权秘钥'",
  17. 'redirect_uri' => "varchar(2000) NULL DEFAULT '' COMMENT '回调Url'",
  18. 'remark' => "varchar(200) NULL DEFAULT '' COMMENT '备注'",
  19. 'group' => "varchar(30) NULL DEFAULT '' COMMENT '组别'",
  20. 'scope' => "json NULL COMMENT '授权'",
  21. 'status' => "tinyint(4) NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]'",
  22. 'created_at' => "int(10) unsigned NULL DEFAULT '0' COMMENT '创建时间'",
  23. 'updated_at' => "int(10) unsigned NULL DEFAULT '0' COMMENT '修改时间'",
  24. 'PRIMARY KEY (`id`)'
  25. ], "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='oauth2_授权客户端'");
  26. /* 索引设置 */
  27. $this->createIndex('client_id','{{%oauth2_client}}','client_id',0);
  28. /* 表数据 */
  29. /* 设置外键约束 */
  30. $this->execute('SET foreign_key_checks = 1;');
  31. }
  32. public function down()
  33. {
  34. $this->execute('SET foreign_key_checks = 0');
  35. /* 删除表 */
  36. $this->dropTable('{{%oauth2_client}}');
  37. $this->execute('SET foreign_key_checks = 1;');
  38. }
  39. }
粤ICP备19079148号