forked from htmlacademy-yii/1674445-task-force-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.sql
89 lines (81 loc) · 2.75 KB
/
schema.sql
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
78
79
80
81
82
83
84
85
86
87
88
89
CREATE DATABASE taskforce
DEFAULT CHARACTER SET utf8
DEFAULT COLLATE utf8_general_ci;
USE taskforce;
CREATE TABLE `categories`
(
cat_id INT AUTO_INCREMENT PRIMARY KEY,
cat_publishdate DATE NOT NULL,
cat_name VARCHAR(128) NOT NULL UNIQUE
);
CREATE TABLE `locations`
(
location_id INT AUTO_INCREMENT PRIMARY KEY,
location_name VARCHAR(128) NOT NULL UNIQUE
);
CREATE TABLE `reviews`
(
review_id INT AUTO_INCREMENT PRIMARY KEY,
review_publishdate DATE NOT NULL,
review_title VARCHAR(128) NOT NULL UNIQUE,
review_rating INT,
review_text TEXT NULL
);
CREATE TABLE `chat_messages`
(
message_id INT AUTO_INCREMENT PRIMARY KEY,
message_publishdate DATE NOT NULL,
message_userid INT NOT NULL,
message_taskid INT NOT NULL,
message_title VARCHAR(128) NOT NULL UNIQUE,
message_text TEXT NULL
);
CREATE TABLE `responses`
(
response_id INT AUTO_INCREMENT PRIMARY KEY,
response_publishdate DATE NOT NULL,
response_userid INT NOT NULL,
response_taskid INT NOT NULL,
response_title VARCHAR(128) NOT NULL UNIQUE,
response_text TEXT NULL
);
CREATE TABLE `users`
(
user_id INT AUTO_INCREMENT PRIMARY KEY,
user_status VARCHAR(128) NOT NULL,
user_publishdate DATE NOT NULL,
user_email VARCHAR(128) NOT NULL,
user_name VARCHAR(32) NOT NULL,
user_password VARCHAR(128) NOT NULL,
user_info TEXT NULL,
user_role VARCHAR(32) NOT NULL,
user_birthday DATE NOT NULL,
user_categories TEXT NULL,
user_cover_image VARCHAR(255) NULL,
user_projects_images TEXT NULL,
user_contacts TEXT NULL,
user_notifications TEXT NULL,
user_show_cotacts BOOLEAN DEFAULT false,
user_hidden BOOLEAN DEFAULT false,
user_messages TEXT NULL,
user_projects TEXT NULL
);
CREATE TABLE `tasks`
(
task_id INT AUTO_INCREMENT PRIMARY KEY,
task_status VARCHAR(128) NOT NULL,
task_publishdate DATE NOT NULL,
task_editdate DATE NOT NULL,
task_closedate DATE NOT NULL,
task_customer_id int NOT NULL,
task_developer_id int,
task_title VARCHAR(32) NOT NULL,
task_info TEXT NULL,
task_categories TEXT NULL,
task_cover_image VARCHAR(255) NULL,
task_projects_images TEXT NULL,
task_projects_files TEXT NULL,
task_notifications TEXT NULL,
task_responses BOOLEAN DEFAULT false,
task_messages TEXT NULL
);