-
Notifications
You must be signed in to change notification settings - Fork 2
/
motivision.sql
608 lines (402 loc) · 13.4 KB
/
motivision.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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
--
-- PostgreSQL database dump
--
-- Dumped from database version 10.4
-- Dumped by pg_dump version 10.4
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: activities; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.activities (
id integer NOT NULL,
name character varying(20) NOT NULL,
reward integer,
team_id integer NOT NULL
);
ALTER TABLE public.activities OWNER TO postgres;
--
-- Name: activities_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.activities_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.activities_id_seq OWNER TO postgres;
--
-- Name: activities_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.activities_id_seq OWNED BY public.activities.id;
--
-- Name: character; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public."character" (
id integer NOT NULL,
player_id bigint NOT NULL,
head_type integer,
body_type integer,
gender character varying(1) NOT NULL,
points integer DEFAULT 0,
name character varying(30) NOT NULL,
team_id integer NOT NULL
);
ALTER TABLE public."character" OWNER TO postgres;
--
-- Name: character_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.character_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.character_id_seq OWNER TO postgres;
--
-- Name: character_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.character_id_seq OWNED BY public."character".id;
--
-- Name: character_item; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.character_item (
id integer NOT NULL,
character_id integer NOT NULL,
item_id integer,
equipped boolean DEFAULT false
);
ALTER TABLE public.character_item OWNER TO postgres;
--
-- Name: character_item_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.character_item_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.character_item_id_seq OWNER TO postgres;
--
-- Name: character_item_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.character_item_id_seq OWNED BY public.character_item.id;
--
-- Name: items; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.items (
id integer NOT NULL,
name character varying(30) NOT NULL,
image_path character varying(30) NOT NULL,
price integer,
type character varying(30)
);
ALTER TABLE public.items OWNER TO postgres;
--
-- Name: items_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.items_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.items_id_seq OWNER TO postgres;
--
-- Name: items_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.items_id_seq OWNED BY public.items.id;
--
-- Name: last_battle; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.last_battle (
id integer NOT NULL,
team_id integer NOT NULL,
enemy_power integer NOT NULL,
team_power integer NOT NULL
);
ALTER TABLE public.last_battle OWNER TO postgres;
--
-- Name: last_battle_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.last_battle_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.last_battle_id_seq OWNER TO postgres;
--
-- Name: last_battle_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.last_battle_id_seq OWNED BY public.last_battle.id;
--
-- Name: player; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.player (
id integer NOT NULL,
login character varying(30) NOT NULL,
password character varying(50) NOT NULL,
points integer DEFAULT 0
);
ALTER TABLE public.player OWNER TO postgres;
--
-- Name: player_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.player_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.player_id_seq OWNER TO postgres;
--
-- Name: player_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.player_id_seq OWNED BY public.player.id;
--
-- Name: team; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.team (
id integer NOT NULL,
name character varying(30) NOT NULL,
lider_id integer,
team_logo character varying(50) NOT NULL,
battle_frequency integer NOT NULL,
team_wins integer DEFAULT 0,
team_loss integer DEFAULT 0,
locked boolean DEFAULT false NOT NULL
);
ALTER TABLE public.team OWNER TO postgres;
--
-- Name: team_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.team_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.team_id_seq OWNER TO postgres;
--
-- Name: team_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.team_id_seq OWNED BY public.team.id;
--
-- Name: activities id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.activities ALTER COLUMN id SET DEFAULT nextval('public.activities_id_seq'::regclass);
--
-- Name: character id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public."character" ALTER COLUMN id SET DEFAULT nextval('public.character_id_seq'::regclass);
--
-- Name: character_item id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.character_item ALTER COLUMN id SET DEFAULT nextval('public.character_item_id_seq'::regclass);
--
-- Name: items id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.items ALTER COLUMN id SET DEFAULT nextval('public.items_id_seq'::regclass);
--
-- Name: last_battle id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.last_battle ALTER COLUMN id SET DEFAULT nextval('public.last_battle_id_seq'::regclass);
--
-- Name: player id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.player ALTER COLUMN id SET DEFAULT nextval('public.player_id_seq'::regclass);
--
-- Name: team id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.team ALTER COLUMN id SET DEFAULT nextval('public.team_id_seq'::regclass);
--
-- Data for Name: activities; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.activities (id, name, reward, team_id) FROM stdin;
\.
--
-- Data for Name: character; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public."character" (id, player_id, head_type, body_type, gender, points, name, team_id) FROM stdin;
\.
--
-- Data for Name: character_item; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.character_item (id, character_id, item_id, equipped) FROM stdin;
\.
--
-- Data for Name: items; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.items (id, name, image_path, price, type) FROM stdin;
5 steel shield shield_3 555 shield
9 gold armor armor_4 777 armor
7 iron armor armor_2 333 armor
6 gold shield shield_4 777 shield
12 gold leggins leggins_4 777 leggins
1 iron sword weapon_2 333 weapon
10 iron leggins leggins_2 333 leggins
8 steel armor armor_3 555 armor
11 steel leggins leggins_3 555 leggins
4 iron shield shield_2 333 shield
2 steel axe weapon_3 555 weapon
3 gold sword weapon_4 777 weapon
\.
--
-- Data for Name: last_battle; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.last_battle (id, team_id, enemy_power, team_power) FROM stdin;
\.
--
-- Data for Name: player; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.player (id, login, password, points) FROM stdin;
\.
--
-- Data for Name: team; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.team (id, name, lider_id, team_logo, battle_frequency, team_wins, team_loss, locked) FROM stdin;
\.
--
-- Name: activities_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.activities_id_seq', 1, false);
--
-- Name: character_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.character_id_seq', 23, true);
--
-- Name: character_item_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.character_item_id_seq', 9, true);
--
-- Name: items_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.items_id_seq', 1, false);
--
-- Name: last_battle_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.last_battle_id_seq', 1, false);
--
-- Name: player_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.player_id_seq', 5, true);
--
-- Name: team_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.team_id_seq', 6, true);
--
-- Name: activities activities_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.activities
ADD CONSTRAINT activities_pkey PRIMARY KEY (id);
--
-- Name: character_item character_item_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.character_item
ADD CONSTRAINT character_item_pkey PRIMARY KEY (id);
--
-- Name: character character_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public."character"
ADD CONSTRAINT character_pkey PRIMARY KEY (id);
--
-- Name: items items_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.items
ADD CONSTRAINT items_pkey PRIMARY KEY (id);
--
-- Name: last_battle last_battle_id_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.last_battle
ADD CONSTRAINT last_battle_id_pk PRIMARY KEY (id);
--
-- Name: player player_id_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.player
ADD CONSTRAINT player_id_pk PRIMARY KEY (id);
--
-- Name: player player_login_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.player
ADD CONSTRAINT player_login_key UNIQUE (login);
--
-- Name: team team_id_pk; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.team
ADD CONSTRAINT team_id_pk PRIMARY KEY (id);
--
-- Name: team team_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.team
ADD CONSTRAINT team_name_key UNIQUE (name);
--
-- Name: character_name_uindex; Type: INDEX; Schema: public; Owner: postgres
--
CREATE UNIQUE INDEX character_name_uindex ON public."character" USING btree (name);
--
-- Name: items_type_uindex; Type: INDEX; Schema: public; Owner: postgres
--
CREATE UNIQUE INDEX items_type_uindex ON public.items USING btree (name);
--
-- Name: activities activities___fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.activities
ADD CONSTRAINT activities___fk FOREIGN KEY (team_id) REFERENCES public.team(id) ON UPDATE CASCADE ON DELETE CASCADE;
--
-- Name: character character___fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public."character"
ADD CONSTRAINT character___fk FOREIGN KEY (player_id) REFERENCES public.player(id) ON DELETE CASCADE;
--
-- Name: character character___fk_2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public."character"
ADD CONSTRAINT character___fk_2 FOREIGN KEY (team_id) REFERENCES public.team(id) ON UPDATE CASCADE ON DELETE CASCADE;
--
-- Name: character_item character_item___fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.character_item
ADD CONSTRAINT character_item___fk FOREIGN KEY (character_id) REFERENCES public."character"(id) ON UPDATE CASCADE ON DELETE CASCADE;
--
-- Name: character_item character_item___fk_2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.character_item
ADD CONSTRAINT character_item___fk_2 FOREIGN KEY (item_id) REFERENCES public.items(id);
--
-- Name: last_battle last_battle___fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.last_battle
ADD CONSTRAINT last_battle___fk FOREIGN KEY (team_id) REFERENCES public.team(id) ON UPDATE CASCADE ON DELETE CASCADE;
--
-- Name: team team___fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.team
ADD CONSTRAINT team___fk FOREIGN KEY (lider_id) REFERENCES public."character"(id) ON UPDATE CASCADE ON DELETE CASCADE;
--
-- PostgreSQL database dump complete
--