· 6 years ago · Dec 23, 2019, 12:02 AM
1CREATE TABLE `tasks` (
2 `id` int(11) NOT NULL AUTO_INCREMENT,
3 `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
4 `status` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
5 `project_id` int(11) NOT NULL,
6 `user_id` int(11) NOT NULL,
7 `create_date` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
8 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
9 PRIMARY KEY (`id`)
10) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
11
12
13CREATE TABLE if not exists taskfilter (
14 id int(11) NOT NULL AUTO_INCREMENT,
15 task_id int(11) NOT NULL,
16 tablename varchar(50) NOT NULL,
17 fieldname varchar(50) NOT NULL,
18 fieldvalue varchar(255),
19 PRIMARY KEY (id),
20 FOREIGN KEY (task_id) REFERENCES tasks (id)
21 ON DELETE CASCADE
22);
23
24CREATE TABLE if not exists tasksolicitations(
25 task_id int(11) not null,
26 solicitation_id int(11) not null,
27 FOREIGN KEY (task_id) REFERENCES tasks (id)
28 ON DELETE CASCADE
29);
30
31
32INSERT INTO datamanagement.tasks (id,description,status,project_id,user_id,create_date,updated_at) VALUES
33(1,'test description','test status',12,1,'12/12/2019','2019-12-20 11:16:38.000')
34;
35
36insert into TASKFILTER(task_id, tablename, fieldname, fieldvalue)
37values (1, 'solicitation', 'recipient', '00000000000000')
38, (1, 'solicitation', 'comment', 'temp comment');
39
40insert into tasksolicitations (task_id, solicitation_id) values (1, 100), (1, 101), (1, 102);