You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 line
1.7KB

  1. /**
  2. * Database schema required by \yii\rbac\DbManager.
  3. *
  4. * @author Qiang Xue <qiang.xue@gmail.com>
  5. * @author Alexander Kochetov <creocoder@gmail.com>
  6. * @link http://www.yiiframework.com/
  7. * @copyright 2008 Yii Software LLC
  8. * @license http://www.yiiframework.com/license/
  9. * @since 2.0
  10. */
  11. drop table "auth_assignment";
  12. drop table "auth_item_child";
  13. drop table "auth_item";
  14. drop table "auth_rule";
  15. -- create new auth_rule table
  16. create table "auth_rule"
  17. (
  18. "name" varchar(64) not null,
  19. "data" varchar(1000),
  20. "created_at" integer,
  21. "updated_at" integer,
  22. primary key ("name")
  23. );
  24. -- create auth_item table
  25. create table "auth_item"
  26. (
  27. "name" varchar(64) not null,
  28. "type" integer not null,
  29. "description" varchar(1000),
  30. "rule_name" varchar(64),
  31. "data" varchar(1000),
  32. "created_at" integer,
  33. "updated_at" integer,
  34. foreign key ("rule_name") references "auth_rule"("name") on delete set null,
  35. primary key ("name")
  36. );
  37. -- adds oracle specific index to auth_item
  38. CREATE INDEX auth_type_index ON "auth_item"("type");
  39. create table "auth_item_child"
  40. (
  41. "parent" varchar(64) not null,
  42. "child" varchar(64) not null,
  43. primary key ("parent","child"),
  44. foreign key ("parent") references "auth_item"("name") on delete cascade,
  45. foreign key ("child") references "auth_item"("name") on delete cascade
  46. );
  47. create table "auth_assignment"
  48. (
  49. "item_name" varchar(64) not null,
  50. "user_id" varchar(64) not null,
  51. "created_at" integer,
  52. primary key ("item_name","user_id"),
  53. foreign key ("item_name") references "auth_item" ("name") on delete cascade
  54. );