-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdataBaseHRMS.sql
315 lines (249 loc) · 8.33 KB
/
dataBaseHRMS.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
-- This script was generated by a beta version of the ERD tool in pgAdmin 4.
-- Please log an issue at https://redmine.postgresql.org/projects/pgadmin4/issues/new if you find any bugs, including reproduction steps.
BEGIN;
CREATE TABLE public.candidates
(
id integer NOT NULL,
first_name character varying(25) NOT NULL,
last_name character varying(25) NOT NULL,
identification_number character varying(11) NOT NULL,
birth_date date NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE public.candidates_cv
(
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
candidate_id integer NOT NULL,
linkedin_address character varying,
github_address character varying,
cover_letter text NOT NULL,
is_active boolean NOT NULL,
avatar_url character varying NOT NULL,
PRIMARY KEY (id)
);
COMMENT ON TABLE public.candidates_cv
IS 'Adayların CV Tablosu';
COMMENT ON COLUMN public.candidates_cv.candidate_id
IS 'ÖN SÖZ';
COMMENT ON COLUMN public.candidates_cv.is_active
IS 'Öne Çıkan CV';
CREATE TABLE public.candidates_cv_school
(
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
school_name character varying NOT NULL,
entry_date date NOT NULL,
graduation_date date,
department character varying NOT NULL,
candidates_cv_id integer NOT NULL,
is_continue boolean,
PRIMARY KEY (id)
);
COMMENT ON TABLE public.candidates_cv_school
IS 'Okullar';
COMMENT ON COLUMN public.candidates_cv_school.department
IS 'Meslek';
CREATE TABLE public.candidates_job_experiences
(
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
workplace_name character varying NOT NULL,
entry_date date NOT NULL,
exit_date date,
job_titles_id integer NOT NULL,
candidates_cv_id integer NOT NULL,
is_continue boolean NOT NULL,
job_detail text,
PRIMARY KEY (id)
);
COMMENT ON TABLE public.candidates_job_experiences
IS ' İŞ DENEYİMLERİ';
CREATE TABLE public.candidates_lang
(
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
candidates_cv_id integer NOT NULL,
languages_id integer NOT NULL,
level integer,
lang_name character varying NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE public.candidates_talent
(
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
talents_id integer NOT NULL,
candidates_cv_id integer NOT NULL,
talent_name character varying,
PRIMARY KEY (id)
);
COMMENT ON TABLE public.candidates_talent
IS 'İş arayan yetenekleri';
CREATE TABLE public.cities
(
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
city_name character varying(50) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE public.employers
(
id integer NOT NULL,
company_name character varying(255) NOT NULL,
web_address character varying(50) NOT NULL,
phone_number character varying(12) NOT NULL,
is_verified boolean,
PRIMARY KEY (id)
);
CREATE TABLE public.favs
(
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
job_advertisement_id integer NOT NULL,
candidate_id integer NOT NULL,
PRIMARY KEY (id)
);
COMMENT ON TABLE public.favs
IS 'favoriler';
CREATE TABLE public.job_advertisements
(
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
employer_id integer NOT NULL,
job_title_id integer NOT NULL,
description text NOT NULL,
city_id integer NOT NULL,
quota integer NOT NULL,
appeal_expiration_date timestamp without time zone NOT NULL,
is_active boolean NOT NULL,
created_date timestamp without time zone,
min_salary double precision NOT NULL,
max_salary double precision NOT NULL,
work_hours_id integer NOT NULL,
work_types_id integer NOT NULL,
is_confirmed_by_admin boolean,
PRIMARY KEY (id)
);
CREATE TABLE public.job_titles
(
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
title character varying(50),
PRIMARY KEY (id)
);
CREATE TABLE public.languages
(
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
languages_name character varying NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE public.system_users
(
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
user_id integer NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE public.talents
(
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
talent_name character varying NOT NULL,
PRIMARY KEY (id)
);
COMMENT ON TABLE public.talents
IS 'Yetenekler Tablosu';
CREATE TABLE public.users
(
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
email_address character varying(50) NOT NULL,
password character varying(25) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE public.verification_codes
(
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
code character varying(38) NOT NULL,
is_verified boolean NOT NULL,
user_id integer NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE public.work_hours
(
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
work_hours character varying NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE public.work_types
(
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
work_type character varying NOT NULL,
PRIMARY KEY (id)
);
ALTER TABLE public.candidates
ADD FOREIGN KEY (id)
REFERENCES public.users (id)
NOT VALID;
ALTER TABLE public.candidates_cv
ADD FOREIGN KEY (candidate_id)
REFERENCES public.candidates (id)
NOT VALID;
ALTER TABLE public.candidates_cv_school
ADD FOREIGN KEY (candidates_cv_id)
REFERENCES public.candidates_cv (id)
NOT VALID;
ALTER TABLE public.candidates_job_experiences
ADD FOREIGN KEY (candidates_cv_id)
REFERENCES public.candidates_cv (id)
NOT VALID;
ALTER TABLE public.candidates_job_experiences
ADD FOREIGN KEY (job_titles_id)
REFERENCES public.job_titles (id)
NOT VALID;
ALTER TABLE public.candidates_lang
ADD FOREIGN KEY (candidates_cv_id)
REFERENCES public.candidates_cv (id)
NOT VALID;
ALTER TABLE public.candidates_lang
ADD FOREIGN KEY (languages_id)
REFERENCES public.languages (id)
NOT VALID;
ALTER TABLE public.candidates_talent
ADD FOREIGN KEY (candidates_cv_id)
REFERENCES public.candidates_cv (id)
NOT VALID;
ALTER TABLE public.candidates_talent
ADD FOREIGN KEY (talents_id)
REFERENCES public.talents (id)
NOT VALID;
ALTER TABLE public.employers
ADD FOREIGN KEY (id)
REFERENCES public.users (id)
NOT VALID;
ALTER TABLE public.favs
ADD FOREIGN KEY (candidate_id)
REFERENCES public.candidates (id)
NOT VALID;
ALTER TABLE public.favs
ADD FOREIGN KEY (job_advertisement_id)
REFERENCES public.job_advertisements (id)
NOT VALID;
ALTER TABLE public.job_advertisements
ADD FOREIGN KEY (city_id)
REFERENCES public.cities (id)
NOT VALID;
ALTER TABLE public.job_advertisements
ADD FOREIGN KEY (employer_id)
REFERENCES public.users (id)
NOT VALID;
ALTER TABLE public.job_advertisements
ADD FOREIGN KEY (job_title_id)
REFERENCES public.job_titles (id)
NOT VALID;
ALTER TABLE public.job_advertisements
ADD FOREIGN KEY (work_hours_id)
REFERENCES public.work_hours (id)
NOT VALID;
ALTER TABLE public.job_advertisements
ADD FOREIGN KEY (work_types_id)
REFERENCES public.work_types (id)
NOT VALID;
ALTER TABLE public.system_users
ADD FOREIGN KEY (user_id)
REFERENCES public.users (id)
NOT VALID;
ALTER TABLE public.verification_codes
ADD FOREIGN KEY (user_id)
REFERENCES public.users (id)
NOT VALID;
END;