1
0
Fork 0
empact/db/schema.sql

100 lines
3.2 KiB
MySQL
Raw Normal View History

2015-03-14 16:28:40 +00:00
DROP TABLE IF EXISTS `contribs`;
CREATE TABLE `contribs` (
2015-03-04 19:34:18 +00:00
`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 '',
`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`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2015-03-04 21:07:02 +00:00
DROP TABLE IF EXISTS `hooks`;
CREATE TABLE `hooks` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`owner` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2015-03-04 19:34:18 +00:00
DROP TABLE IF EXISTS `members`;
CREATE TABLE `members` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
2015-03-14 16:28:40 +00:00
`org` varchar(255) NOT NULL DEFAULT '',
`team_id` int(11) unsigned DEFAULT NULL,
`user` varchar(255) NOT NULL DEFAULT '',
2015-03-04 19:34:18 +00:00
PRIMARY KEY (`id`),
KEY `team` (`team_id`),
2015-03-14 16:28:40 +00:00
KEY `login` (`user`)
2015-03-04 19:34:18 +00:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2015-03-14 16:28:40 +00:00
DROP TABLE IF EXISTS `orgs`;
CREATE TABLE `orgs` (
2015-03-04 19:34:18 +00:00
`login` varchar(255) NOT NULL DEFAULT '',
2015-03-14 16:28:40 +00:00
`descr` varchar(255) NOT NULL DEFAULT '',
`id` int(11) unsigned NOT NULL,
`avatar_url` varchar(255) NOT NULL DEFAULT '',
2015-03-04 19:34:18 +00:00
PRIMARY KEY (`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 '',
2015-03-04 21:07:02 +00:00
`name` varchar(255) NOT NULL DEFAULT '',
2015-03-04 19:34:18 +00:00
`updated_at` datetime DEFAULT NULL,
`is_private` tinyint(1) NOT NULL,
`is_fork` tinyint(1) NOT NULL,
PRIMARY KEY (`id`),
2015-03-04 21:07:02 +00:00
UNIQUE KEY `owner_repo` (`owner`,`name`)
2015-03-04 19:34:18 +00:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2015-03-14 16:28:40 +00:00
DROP TABLE IF EXISTS `tasks`;
CREATE TABLE `tasks` (
`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`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2015-03-04 21:07:02 +00:00
2015-03-04 19:34:18 +00:00
DROP TABLE IF EXISTS `teams`;
CREATE TABLE `teams` (
`id` int(11) unsigned NOT NULL,
2015-03-14 16:28:40 +00:00
`slug` varchar(255) NOT NULL,
2015-03-04 19:34:18 +00:00
`owner` varchar(255) NOT NULL DEFAULT '',
2015-03-04 21:07:02 +00:00
`name` varchar(255) NOT NULL DEFAULT '',
2015-03-04 19:34:18 +00:00
PRIMARY KEY (`id`),
2015-03-14 16:28:40 +00:00
KEY `owner` (`owner`)
2015-03-04 19:34:18 +00:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `tokens`;
CREATE TABLE `tokens` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
2015-03-14 16:28:40 +00:00
`user` varchar(255) NOT NULL DEFAULT '',
2015-03-04 19:34:18 +00:00
`token` varchar(40) NOT NULL DEFAULT '',
2015-03-14 16:28:40 +00:00
`quota` int(11) unsigned NOT NULL,
2015-03-04 19:34:18 +00:00
`remaining` int(11) unsigned NOT NULL,
`reset_at` datetime DEFAULT NULL,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
2015-03-14 16:28:40 +00:00
UNIQUE KEY `owner` (`user`)
2015-03-04 19:34:18 +00:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2015-03-04 21:07:02 +00:00
2015-03-14 16:28:40 +00:00
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`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`)
2015-03-04 21:07:02 +00:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8;