schema-mssql.sql 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * Database schema required by CDbAuthManager.
  3. *
  4. * @author Qiang Xue <qiang.xue@gmail.com>
  5. * @link http://www.yiiframework.com/
  6. * @copyright 2008 Yii Software LLC
  7. * @license http://www.yiiframework.com/license/
  8. * @since 1.0
  9. */
  10. drop table if exists [AuthAssignment];
  11. drop table if exists [AuthItemChild];
  12. drop table if exists [AuthItem];
  13. create table [AuthItem]
  14. (
  15. [name] varchar(64) not null,
  16. [type] integer not null,
  17. [description] text,
  18. [bizrule] text,
  19. [data] text,
  20. primary key ([name])
  21. );
  22. create table [AuthItemChild]
  23. (
  24. [parent] varchar(64) not null,
  25. [child] varchar(64) not null,
  26. primary key ([parent],[child]),
  27. foreign key ([parent]) references [AuthItem] ([name]) on delete cascade on update cascade,
  28. foreign key ([child]) references [AuthItem] ([name]) on delete cascade on update cascade
  29. );
  30. create table [AuthAssignment]
  31. (
  32. [itemname] varchar(64) not null,
  33. [userid] varchar(64) not null,
  34. [bizrule] text,
  35. [data] text,
  36. primary key ([itemname],[userid]),
  37. foreign key ([itemname]) references [AuthItem] ([name]) on delete cascade on update cascade
  38. );