Commit 83882540 authored by Matija Obreza's avatar Matija Obreza
Browse files

Included DDLs for acl and teams

parent 3aa40893
create table acl_sid (
id bigint unsigned not null auto_increment primary key,
principal tinyint(1) not null,
sid varchar(100) not null,
unique index acl_sid_idx_1 (sid, principal)
) engine = InnoDb;
create table acl_class (
id bigint unsigned not null auto_increment primary key,
class varchar(100) unique not null
) engine = InnoDb;
create table acl_object_identity (
id bigint unsigned not null auto_increment primary key,
object_id_class bigint unsigned not null,
object_id_identity bigint unsigned not null,
parent_object bigint unsigned,
owner_sid bigint unsigned,
entries_inheriting tinyint(1) not null,
unique index acl_object_identity_idx_1
(object_id_class, object_id_identity),
foreign key (object_id_class) references acl_class (id),
foreign key (parent_object) references acl_object_identity (id),
foreign key (owner_sid) references acl_sid (id)
) engine = InnoDb;
create table acl_entry (
id bigint unsigned not null auto_increment primary key,
acl_object_identity bigint unsigned not null,
ace_order int unsigned not null,
sid bigint unsigned not null,
mask int not null,
granting tinyint(1) not null,
audit_success tinyint(1) not null,
audit_failure tinyint(1) not null,
unique index acl_entry_idx_1 (acl_object_identity, ace_order),
foreign key (acl_object_identity)
references acl_object_identity (id),
foreign key (sid) references acl_sid (id)
) engine = InnoDb;
\ No newline at end of file
DROP TABLE IF EXISTS `teammember`;
DROP TABLE IF EXISTS `teaminstitute`;
DROP TABLE IF EXISTS `team`;
CREATE TABLE IF NOT EXISTS `team` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(200) NOT NULL,
`uuid` varchar(36) NOT NULL,
`version` bigint(20) not null default 0,
`createdBy` bigint(20) DEFAULT NULL,
`createdDate` datetime DEFAULT NULL,
`lastModifiedBy` bigint(20) DEFAULT NULL,
`lastModifiedDate` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `team_UC_name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `teammember` (
`teamId` bigint(20) NOT NULL,
`userId` bigint(20) NOT NULL,
PRIMARY KEY (`teamId`, `userId`),
CONSTRAINT `FK_team_team` FOREIGN KEY (`teamId`) REFERENCES `team` (`id`),
CONSTRAINT `FK_team_user` FOREIGN KEY (`userId`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `teaminstitute` (
`teamId` bigint(20) NOT NULL,
`instituteId` bigint(20) NOT NULL,
PRIMARY KEY (`teamId`, `instituteId`),
CONSTRAINT `FK_teammember_team` FOREIGN KEY (`teamId`) REFERENCES `team` (`id`),
CONSTRAINT `FK_teammember_institute` FOREIGN KEY (`instituteId`) REFERENCES `faoinstitute` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `user` ADD COLUMN `uuid` varchar(36) NOT NULL DEFAULT 'changeme' AFTER `id`;
UPDATE `user` set `uuid`=(SELECT UUID()) WHERE `uuid` = 'changeme';
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment