1 | CREATE DATABASE tinki;
|
---|
2 |
|
---|
3 | CREATE USER tinki WITH PASSWORD '.';
|
---|
4 |
|
---|
5 | ALTER DATABASE tinki OWNER TO tinki;
|
---|
6 |
|
---|
7 | -- public.address definition
|
---|
8 |
|
---|
9 | -- Drop table
|
---|
10 |
|
---|
11 | -- DROP TABLE public.address;
|
---|
12 |
|
---|
13 | CREATE TABLE public.address (
|
---|
14 | id bigserial NOT NULL,
|
---|
15 | city varchar(255) NULL,
|
---|
16 | country varchar(255) NULL,
|
---|
17 | street varchar(255) NULL,
|
---|
18 | CONSTRAINT address_pkey PRIMARY KEY (id)
|
---|
19 | );
|
---|
20 |
|
---|
21 |
|
---|
22 | -- public.internship definition
|
---|
23 |
|
---|
24 | -- Drop table
|
---|
25 |
|
---|
26 | -- DROP TABLE public.internship;
|
---|
27 |
|
---|
28 | CREATE TABLE public.internship (
|
---|
29 | id int8 NOT NULL,
|
---|
30 | description varchar(255) NULL,
|
---|
31 | salary int4 NOT NULL,
|
---|
32 | title varchar(255) NULL,
|
---|
33 | account_id int8 NULL,
|
---|
34 | open_spots int4 NOT NULL,
|
---|
35 | CONSTRAINT internship_pkey PRIMARY KEY (id)
|
---|
36 | );
|
---|
37 |
|
---|
38 |
|
---|
39 | -- public.job definition
|
---|
40 |
|
---|
41 | -- Drop table
|
---|
42 |
|
---|
43 | -- DROP TABLE public.job;
|
---|
44 |
|
---|
45 | CREATE TABLE public.job (
|
---|
46 | id int8 NOT NULL,
|
---|
47 | description varchar(255) NULL,
|
---|
48 | salary int4 NOT NULL,
|
---|
49 | title varchar(255) NULL,
|
---|
50 | account_id int8 NULL,
|
---|
51 | CONSTRAINT job_pkey PRIMARY KEY (id)
|
---|
52 | );
|
---|
53 |
|
---|
54 |
|
---|
55 | -- public.project definition
|
---|
56 |
|
---|
57 | -- Drop table
|
---|
58 |
|
---|
59 | -- DROP TABLE public.project;
|
---|
60 |
|
---|
61 | CREATE TABLE public.project (
|
---|
62 | id int8 NOT NULL,
|
---|
63 | description varchar(255) NULL,
|
---|
64 | salary int4 NOT NULL,
|
---|
65 | title varchar(255) NULL,
|
---|
66 | account_id int8 NULL,
|
---|
67 | valid_until timestamp NULL,
|
---|
68 | CONSTRAINT project_pkey PRIMARY KEY (id)
|
---|
69 | );
|
---|
70 |
|
---|
71 |
|
---|
72 | -- public.skill definition
|
---|
73 |
|
---|
74 | -- Drop table
|
---|
75 |
|
---|
76 | -- DROP TABLE public.skill;
|
---|
77 |
|
---|
78 | CREATE TABLE public.skill (
|
---|
79 | id bigserial NOT NULL,
|
---|
80 | "name" varchar(255) NULL,
|
---|
81 | CONSTRAINT skill_pkey PRIMARY KEY (id)
|
---|
82 | );
|
---|
83 |
|
---|
84 |
|
---|
85 | -- public.team definition
|
---|
86 |
|
---|
87 | -- Drop table
|
---|
88 |
|
---|
89 | -- DROP TABLE public.team;
|
---|
90 |
|
---|
91 | CREATE TABLE public.team (
|
---|
92 | id int8 NOT NULL,
|
---|
93 | account_type int4 NULL,
|
---|
94 | email varchar(255) NULL,
|
---|
95 | "name" varchar(255) NULL,
|
---|
96 | "password" varchar(255) NULL,
|
---|
97 | members int4 NOT NULL,
|
---|
98 | CONSTRAINT team_pkey PRIMARY KEY (id),
|
---|
99 | CONSTRAINT uk_40rwssq6p5ns2btjpdjesrs7 UNIQUE (email)
|
---|
100 | );
|
---|
101 |
|
---|
102 |
|
---|
103 | -- public.users definition
|
---|
104 |
|
---|
105 | -- Drop table
|
---|
106 |
|
---|
107 | -- DROP TABLE public.users;
|
---|
108 |
|
---|
109 | CREATE TABLE public.users (
|
---|
110 | id int8 NOT NULL,
|
---|
111 | account_type int4 NULL,
|
---|
112 | email varchar(255) NULL,
|
---|
113 | "name" varchar(255) NULL,
|
---|
114 | "password" varchar(255) NULL,
|
---|
115 | surname varchar(255) NULL,
|
---|
116 | CONSTRAINT uk_6dotkott2kjsp8vw4d0m25fb7 UNIQUE (email),
|
---|
117 | CONSTRAINT users_pkey PRIMARY KEY (id)
|
---|
118 | );
|
---|
119 |
|
---|
120 |
|
---|
121 | -- public.company definition
|
---|
122 |
|
---|
123 | -- Drop table
|
---|
124 |
|
---|
125 | -- DROP TABLE public.company;
|
---|
126 |
|
---|
127 | CREATE TABLE public.company (
|
---|
128 | id int8 NOT NULL,
|
---|
129 | account_type int4 NULL,
|
---|
130 | email varchar(255) NULL,
|
---|
131 | "name" varchar(255) NULL,
|
---|
132 | "password" varchar(255) NULL,
|
---|
133 | address_id int8 NULL,
|
---|
134 | CONSTRAINT company_pkey PRIMARY KEY (id),
|
---|
135 | CONSTRAINT uk_bma9lv19ba3yjwf12a34xord3 UNIQUE (email),
|
---|
136 | CONSTRAINT fkgfifm4874ce6mecwj54wdb3ma FOREIGN KEY (address_id) REFERENCES address(id)
|
---|
137 | );
|
---|
138 |
|
---|
139 |
|
---|
140 | -- public.internship_skills_trained definition
|
---|
141 |
|
---|
142 | -- Drop table
|
---|
143 |
|
---|
144 | -- DROP TABLE public.internship_skills_trained;
|
---|
145 |
|
---|
146 | CREATE TABLE public.internship_skills_trained (
|
---|
147 | internship_id int8 NOT NULL,
|
---|
148 | skills_trained_id int8 NOT NULL,
|
---|
149 | CONSTRAINT fkaffo89daxg10hnaoiq2q4dj0f FOREIGN KEY (internship_id) REFERENCES internship(id),
|
---|
150 | CONSTRAINT fks4c3ng84ax1cj4cm3pmdjljos FOREIGN KEY (skills_trained_id) REFERENCES skill(id)
|
---|
151 | );
|
---|
152 |
|
---|
153 |
|
---|
154 | -- public.job_skills_required definition
|
---|
155 |
|
---|
156 | -- Drop table
|
---|
157 |
|
---|
158 | -- DROP TABLE public.job_skills_required;
|
---|
159 |
|
---|
160 | CREATE TABLE public.job_skills_required (
|
---|
161 | job_id int8 NOT NULL,
|
---|
162 | skills_required_id int8 NOT NULL,
|
---|
163 | CONSTRAINT fk8shkwbrkfqf595ejsx1awyqm5 FOREIGN KEY (skills_required_id) REFERENCES skill(id),
|
---|
164 | CONSTRAINT fkd9624v3iv0b875ekie7xixq61 FOREIGN KEY (job_id) REFERENCES job(id)
|
---|
165 | );
|
---|
166 |
|
---|
167 |
|
---|
168 | -- public."match" definition
|
---|
169 |
|
---|
170 | -- Drop table
|
---|
171 |
|
---|
172 | -- DROP TABLE public."match";
|
---|
173 |
|
---|
174 | CREATE TABLE public."match" (
|
---|
175 | coefficient float4 NOT NULL,
|
---|
176 | "type" int4 NULL,
|
---|
177 | user_id int8 NOT NULL,
|
---|
178 | work_id int8 NOT NULL,
|
---|
179 | CONSTRAINT match_pkey PRIMARY KEY (user_id, work_id),
|
---|
180 | CONSTRAINT fkcvroh7plwfu0pp9inhs51i1w6 FOREIGN KEY (user_id) REFERENCES users(id)
|
---|
181 | );
|
---|
182 |
|
---|
183 |
|
---|
184 | -- public.project_skills_required definition
|
---|
185 |
|
---|
186 | -- Drop table
|
---|
187 |
|
---|
188 | -- DROP TABLE public.project_skills_required;
|
---|
189 |
|
---|
190 | CREATE TABLE public.project_skills_required (
|
---|
191 | project_id int8 NOT NULL,
|
---|
192 | skills_required_id int8 NOT NULL,
|
---|
193 | CONSTRAINT fkbpxfe2agmbrnt5s9bljjpyl15 FOREIGN KEY (project_id) REFERENCES project(id),
|
---|
194 | CONSTRAINT fkhavvnnjpwbo99mwvr9fp2akgj FOREIGN KEY (skills_required_id) REFERENCES skill(id)
|
---|
195 | );
|
---|
196 |
|
---|
197 |
|
---|
198 | -- public.users_retained_skills definition
|
---|
199 |
|
---|
200 | -- Drop table
|
---|
201 |
|
---|
202 | -- DROP TABLE public.users_retained_skills;
|
---|
203 |
|
---|
204 | CREATE TABLE public.users_retained_skills (
|
---|
205 | users_id int8 NOT NULL,
|
---|
206 | retained_skills_id int8 NOT NULL,
|
---|
207 | CONSTRAINT fk173wmfmh98upsm5nroy742ivh FOREIGN KEY (retained_skills_id) REFERENCES skill(id),
|
---|
208 | CONSTRAINT fkcva0reqw29kym3pp492jwnnq9 FOREIGN KEY (users_id) REFERENCES users(id)
|
---|
209 | );
|
---|
210 |
|
---|
211 |
|
---|
212 | -- public.users_skills_to_learn definition
|
---|
213 |
|
---|
214 | -- Drop table
|
---|
215 |
|
---|
216 | -- DROP TABLE public.users_skills_to_learn;
|
---|
217 |
|
---|
218 | CREATE TABLE public.users_skills_to_learn (
|
---|
219 | users_id int8 NOT NULL,
|
---|
220 | skills_to_learn_id int8 NOT NULL,
|
---|
221 | CONSTRAINT fkn0j449kx3g55p2fqudar6n8q5 FOREIGN KEY (users_id) REFERENCES users(id),
|
---|
222 | CONSTRAINT fkochtgvcbv6gru34o2bp38uss7 FOREIGN KEY (skills_to_learn_id) REFERENCES skill(id)
|
---|
223 | ); |
---|