Update schema
This commit is contained in:
parent
86d503d622
commit
7bcab0002a
|
@ -2,77 +2,84 @@ DROP TABLE IF EXISTS `contribs`;
|
|||
CREATE TABLE `contribs` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`week` int(11) unsigned NOT NULL,
|
||||
`author` varchar(255) NOT NULL DEFAULT '',
|
||||
`owner` varchar(255) NOT NULL DEFAULT '',
|
||||
`repo` varchar(255) NOT NULL DEFAULT '',
|
||||
`org_id` int(11) unsigned NOT NULL,
|
||||
`repo_id` int(11) unsigned NOT NULL,
|
||||
`user_id` int(11) unsigned NOT NULL,
|
||||
`commits` int(11) unsigned NOT NULL,
|
||||
`additions` int(11) unsigned NOT NULL,
|
||||
`deletions` int(11) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `week_author_repo` (`week`,`author`,`owner`,`repo`)
|
||||
UNIQUE KEY `record` (`week`,`org_id`,`repo_id`,`user_id`),
|
||||
KEY `search` (`org_id`,`week`,`repo_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `hooks`;
|
||||
CREATE TABLE `hooks` (
|
||||
DROP TABLE IF EXISTS `org_members`;
|
||||
CREATE TABLE `org_members` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`owner` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `members`;
|
||||
CREATE TABLE `members` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`org` varchar(255) NOT NULL DEFAULT '',
|
||||
`team_id` int(11) unsigned DEFAULT NULL,
|
||||
`user` varchar(255) NOT NULL DEFAULT '',
|
||||
`org_id` int(11) unsigned NOT NULL,
|
||||
`user_id` int(11) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `team` (`team_id`),
|
||||
KEY `login` (`user`)
|
||||
UNIQUE KEY `membership` (`org_id`,`user_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `orgs`;
|
||||
CREATE TABLE `orgs` (
|
||||
`login` varchar(255) NOT NULL DEFAULT '',
|
||||
`descr` varchar(255) NOT NULL DEFAULT '',
|
||||
`id` int(11) unsigned NOT NULL,
|
||||
`login` varchar(255) NOT NULL DEFAULT '',
|
||||
`company` varchar(255) NOT NULL DEFAULT '',
|
||||
`avatar_url` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`login`)
|
||||
`updated_at` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `login` (`login`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `repos`;
|
||||
CREATE TABLE `repos` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`owner` varchar(255) NOT NULL DEFAULT '',
|
||||
`id` int(11) unsigned NOT NULL,
|
||||
`org_id` int(11) unsigned NOT NULL,
|
||||
`name` varchar(255) NOT NULL DEFAULT '',
|
||||
`updated_at` datetime DEFAULT NULL,
|
||||
`description` varchar(255) NOT NULL,
|
||||
`is_private` tinyint(1) NOT NULL,
|
||||
`is_fork` tinyint(1) NOT NULL,
|
||||
`updated_at` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `owner_repo` (`owner`,`name`)
|
||||
UNIQUE KEY `owner_repo` (`org_id`,`name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `tasks`;
|
||||
CREATE TABLE `tasks` (
|
||||
DROP TABLE IF EXISTS `team_members`;
|
||||
CREATE TABLE `team_members` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`token` varchar(255) DEFAULT '',
|
||||
`owner` varchar(255) DEFAULT '',
|
||||
`job` varchar(255) NOT NULL DEFAULT '',
|
||||
`worker` varchar(36) NOT NULL DEFAULT '',
|
||||
`duration` int(11) unsigned NOT NULL,
|
||||
`error` varchar(255) DEFAULT NULL,
|
||||
`created_at` datetime NOT NULL,
|
||||
`started_at` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
`org_id` int(11) unsigned NOT NULL,
|
||||
`team_id` int(11) unsigned NOT NULL,
|
||||
`user_id` int(11) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `membership` (`team_id`,`user_id`),
|
||||
KEY `search` (`org_id`,`user_id`),
|
||||
KEY `team_id` (`team_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `team_repos`;
|
||||
CREATE TABLE `team_repos` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`org_id` int(11) unsigned NOT NULL,
|
||||
`team_id` int(11) unsigned NOT NULL,
|
||||
`repo_id` int(11) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `access` (`team_id`,`repo_id`),
|
||||
KEY `search` (`org_id`,`team_id`),
|
||||
KEY `team_id` (`team_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `teams`;
|
||||
CREATE TABLE `teams` (
|
||||
`id` int(11) unsigned NOT NULL,
|
||||
`org_id` int(11) NOT NULL,
|
||||
`slug` varchar(255) NOT NULL,
|
||||
`owner` varchar(255) NOT NULL DEFAULT '',
|
||||
`name` varchar(255) NOT NULL DEFAULT '',
|
||||
`name` varchar(255) NOT NULL,
|
||||
`permission` varchar(20) NOT NULL DEFAULT '',
|
||||
`updated_at` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `owner` (`owner`)
|
||||
KEY `owner` (`org_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `tokens`;
|
||||
|
@ -85,15 +92,17 @@ CREATE TABLE `tokens` (
|
|||
`reset_at` datetime DEFAULT NULL,
|
||||
`created_at` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `owner` (`user`)
|
||||
UNIQUE KEY `owner` (`user`),
|
||||
UNIQUE KEY `token` (`token`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `users`;
|
||||
CREATE TABLE `users` (
|
||||
`id` int(11) unsigned NOT NULL,
|
||||
`login` varchar(255) NOT NULL DEFAULT '',
|
||||
`name` varchar(255) NOT NULL DEFAULT '',
|
||||
`id` int(11) unsigned NOT NULL,
|
||||
`avatar_url` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`login`),
|
||||
UNIQUE KEY `id` (`id`)
|
||||
`updated_at` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `login` (`login`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
Loading…
Reference in New Issue