schema-mssql.sql 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * Database schema required by \yii\rbac\DbManager.
  3. *
  4. * @author Qiang Xue <[email protected]>
  5. * @author Alexander Kochetov <[email protected]>
  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 [tbl_auth_assignment];
  12. drop table if exists [tbl_auth_item_child];
  13. drop table if exists [tbl_auth_item];
  14. create table [tbl_auth_item]
  15. (
  16. [name] varchar(64) not null,
  17. [type] integer not null,
  18. [description] text,
  19. [biz_rule] text,
  20. [data] text,
  21. primary key ([name]),
  22. key [type] ([type])
  23. );
  24. create table [tbl_auth_item_child]
  25. (
  26. [parent] varchar(64) not null,
  27. [child] varchar(64) not null,
  28. primary key ([parent],[child]),
  29. foreign key ([parent]) references [tbl_auth_item] ([name]) on delete cascade on update cascade,
  30. foreign key ([child]) references [tbl_auth_item] ([name]) on delete cascade on update cascade
  31. );
  32. create table [tbl_auth_assignment]
  33. (
  34. [item_name] varchar(64) not null,
  35. [user_id] varchar(64) not null,
  36. [biz_rule] text,
  37. [data] text,
  38. primary key ([item_name],[user_id]),
  39. foreign key ([item_name]) references [tbl_auth_item] ([name]) on delete cascade on update cascade
  40. );