summaryrefslogtreecommitdiff
path: root/framework/web/auth/schema-mssql.sql
blob: 7c1208bd41d5e12e144ebf74e1a42ff6a8038f6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
 * Database schema required by CDbAuthManager.
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @link http://www.yiiframework.com/
 * @copyright Copyright &copy; 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 * @since 1.0
 */

drop table if exists [AuthAssignment];
drop table if exists [AuthItemChild];
drop table if exists [AuthItem];

create table [AuthItem]
(
   [name]                 varchar(64) not null,
   [type]                 integer not null,
   [description]          text,
   [bizrule]              text,
   [data]                 text,
   primary key ([name])
);

create table [AuthItemChild]
(
   [parent]               varchar(64) not null,
   [child]                varchar(64) not null,
   primary key ([parent],[child]),
   foreign key ([parent]) references [AuthItem] ([name]) on delete cascade on update cascade,
   foreign key ([child]) references [AuthItem] ([name]) on delete cascade on update cascade
);

create table [AuthAssignment]
(
   [itemname]             varchar(64) not null,
   [userid]               varchar(64) not null,
   [bizrule]              text,
   [data]                 text,
   primary key ([itemname],[userid]),
   foreign key ([itemname]) references [AuthItem] ([name]) on delete cascade on update cascade
);