-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbpositive.sql
More file actions
77 lines (68 loc) · 2.92 KB
/
bpositive.sql
File metadata and controls
77 lines (68 loc) · 2.92 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# noinspection SqlNoDataSourceInspectionForFile
CREATE DATABASE IF NOT EXISTS `bpositive` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `bpositive`;
GRANT ALL PRIVILEGES ON `bpositive`.* TO `bpositive`@localhost IDENTIFIED BY 'bpositivepass';
CREATE TABLE `project` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`description` text NOT NULL,
`deleted` int(11) NOT NULL,
`creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`code` varchar(12) NOT NULL,
`publicPassword` varchar(128) DEFAULT NULL,
`privatePassword` varchar(128) DEFAULT NULL,
`public` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `code_UNIQUE` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `transcription` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(25) NOT NULL,
`experiment` VARCHAR(25) NOT NULL DEFAULT 'ClustalW2',
`description` text NOT NULL,
`linkZip` varchar(100) NOT NULL,
`linkPdf` varchar(100) NOT NULL,
`deleted` int(11) NOT NULL,
`projectId` int(11) NOT NULL,
`creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`analyzed` int(11) NOT NULL,
`positivelySelected` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `roles` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `users` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`role_id` int(11) unsigned NOT NULL DEFAULT '2',
PRIMARY KEY (`id`),
UNIQUE KEY `users_email_unique` (`email`),
KEY `fk_role_idx` (`role_id`),
CONSTRAINT `fk_role` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `password_resets` (
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`token` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
KEY `password_resets_email_index` (`email`),
KEY `password_resets_token_index` (`token`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `users_projects` (
`userId` int(10) unsigned NOT NULL,
`projectId` int(10) NOT NULL,
PRIMARY KEY (`userId`,`projectId`),
KEY `fk_projects_idx` (`projectId`),
CONSTRAINT `fk_projects` FOREIGN KEY (`projectId`) REFERENCES `project` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_users` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `roles` WRITE;
INSERT INTO `roles` VALUES (1,'Administrator'),(2,'User');
UNLOCK TABLES;