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.

schema-pgsql.sql 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 if exists "auth_assignment";
  12. drop table if exists "auth_item_child";
  13. drop table if exists "auth_item";
  14. drop table if exists "auth_rule";
  15. create table "auth_rule"
  16. (
  17. "name" varchar(64) not null,
  18. "data" text,
  19. "created_at" integer,
  20. "updated_at" integer,
  21. primary key ("name")
  22. );
  23. create table "auth_item"
  24. (
  25. "name" varchar(64) not null,
  26. "type" integer not null,
  27. "description" text,
  28. "rule_name" varchar(64),
  29. "data" text,
  30. "created_at" integer,
  31. "updated_at" integer,
  32. primary key ("name"),
  33. foreign key ("rule_name") references "auth_rule" ("name") on delete set null on update cascade
  34. );
  35. create index auth_item_type_idx on "auth_item" ("type");
  36. create table "auth_item_child"
  37. (
  38. "parent" varchar(64) not null,
  39. "child" varchar(64) not null,
  40. primary key ("parent","child"),
  41. foreign key ("parent") references "auth_item" ("name") on delete cascade on update cascade,
  42. foreign key ("child") references "auth_item" ("name") on delete cascade on update cascade
  43. );
  44. create table "auth_assignment"
  45. (
  46. "item_name" varchar(64) not null,
  47. "user_id" varchar(64) not null,
  48. "created_at" integer,
  49. primary key ("item_name","user_id"),
  50. foreign key ("item_name") references "auth_item" ("name") on delete cascade on update cascade
  51. );