m220227_143429_rbac_auth_assignment.php 1007 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. use yii\db\Migration;
  3. class m220227_143429_rbac_auth_assignment extends Migration
  4. {
  5. public function up()
  6. {
  7. /* 取消外键约束 */
  8. $this->execute('SET foreign_key_checks = 0');
  9. /* 创建表 */
  10. $this->createTable('{{%rbac_auth_assignment}}', [
  11. 'role_id' => "int(11) NOT NULL COMMENT '角色'",
  12. 'user_id' => "int(11) NOT NULL COMMENT '用户'",
  13. 'app_id' => "varchar(20) NULL DEFAULT '' COMMENT '应用入口'",
  14. ], "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='公用_会员授权角色表'");
  15. /* 索引设置 */
  16. /* 表数据 */
  17. /* 设置外键约束 */
  18. $this->execute('SET foreign_key_checks = 1;');
  19. }
  20. public function down()
  21. {
  22. $this->execute('SET foreign_key_checks = 0');
  23. /* 删除表 */
  24. $this->dropTable('{{%rbac_auth_assignment}}');
  25. $this->execute('SET foreign_key_checks = 1;');
  26. }
  27. }
粤ICP备19079148号