-
Notifications
You must be signed in to change notification settings - Fork 0
/
wemebox.sql
679 lines (450 loc) · 16 KB
/
wemebox.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
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
--
-- PostgreSQL database dump
--
-- Dumped from database version 10.21 (Ubuntu 10.21-0ubuntu0.18.04.1)
-- Dumped by pg_dump version 10.21 (Ubuntu 10.21-0ubuntu0.18.04.1)
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 xmloption = content;
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: blog; Type: TABLE; Schema: public; Owner: devasia
--
CREATE TABLE public.blog (
blog_id integer NOT NULL,
blog_type character varying(20),
blog_title character varying(1024),
blog_markdown text,
blog_html text,
blog_slug character varying(1024),
created timestamp without time zone,
last_edited timestamp without time zone,
domain_id integer
);
ALTER TABLE public.blog OWNER TO devasia;
--
-- Name: blog_blog_id_seq; Type: SEQUENCE; Schema: public; Owner: devasia
--
CREATE SEQUENCE public.blog_blog_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.blog_blog_id_seq OWNER TO devasia;
--
-- Name: blog_blog_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: devasia
--
ALTER SEQUENCE public.blog_blog_id_seq OWNED BY public.blog.blog_id;
--
-- Name: blog_tag; Type: TABLE; Schema: public; Owner: devasia
--
CREATE TABLE public.blog_tag (
blog_tag_id integer NOT NULL,
blog_id integer,
tag_id integer
);
ALTER TABLE public.blog_tag OWNER TO devasia;
--
-- Name: blog_tag_blog_tag_id_seq; Type: SEQUENCE; Schema: public; Owner: devasia
--
CREATE SEQUENCE public.blog_tag_blog_tag_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.blog_tag_blog_tag_id_seq OWNER TO devasia;
--
-- Name: blog_tag_blog_tag_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: devasia
--
ALTER SEQUENCE public.blog_tag_blog_tag_id_seq OWNED BY public.blog_tag.blog_tag_id;
--
-- Name: domain; Type: TABLE; Schema: public; Owner: devasia
--
CREATE TABLE public.domain (
domain_id integer NOT NULL,
domain_name character varying(255),
domain_dir character varying(255)
);
ALTER TABLE public.domain OWNER TO devasia;
--
-- Name: domain_domain_id_seq; Type: SEQUENCE; Schema: public; Owner: devasia
--
CREATE SEQUENCE public.domain_domain_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.domain_domain_id_seq OWNER TO devasia;
--
-- Name: domain_domain_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: devasia
--
ALTER SEQUENCE public.domain_domain_id_seq OWNED BY public.domain.domain_id;
--
-- Name: domain_user_role; Type: TABLE; Schema: public; Owner: devasia
--
CREATE TABLE public.domain_user_role (
role_id integer NOT NULL,
role character varying(20) DEFAULT 'user'::character varying NOT NULL,
user_account_id integer,
domain_id integer
);
ALTER TABLE public.domain_user_role OWNER TO devasia;
--
-- Name: domain_user_role_role_id_seq; Type: SEQUENCE; Schema: public; Owner: devasia
--
CREATE SEQUENCE public.domain_user_role_role_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.domain_user_role_role_id_seq OWNER TO devasia;
--
-- Name: domain_user_role_role_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: devasia
--
ALTER SEQUENCE public.domain_user_role_role_id_seq OWNED BY public.domain_user_role.role_id;
--
-- Name: page; Type: TABLE; Schema: public; Owner: devasia
--
CREATE TABLE public.page (
page_id integer NOT NULL,
page_slug character varying(1024),
page_file character varying(255),
base_page_file character varying(255) DEFAULT 'base.html'::character varying NOT NULL,
domain_id integer
);
ALTER TABLE public.page OWNER TO devasia;
--
-- Name: page_page_id_seq; Type: SEQUENCE; Schema: public; Owner: devasia
--
CREATE SEQUENCE public.page_page_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.page_page_id_seq OWNER TO devasia;
--
-- Name: page_page_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: devasia
--
ALTER SEQUENCE public.page_page_id_seq OWNED BY public.page.page_id;
--
-- Name: tag; Type: TABLE; Schema: public; Owner: devasia
--
CREATE TABLE public.tag (
tag_id integer NOT NULL,
tag_name character varying(256) NOT NULL
);
ALTER TABLE public.tag OWNER TO devasia;
--
-- Name: tag_tag_id_seq; Type: SEQUENCE; Schema: public; Owner: devasia
--
CREATE SEQUENCE public.tag_tag_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.tag_tag_id_seq OWNER TO devasia;
--
-- Name: tag_tag_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: devasia
--
ALTER SEQUENCE public.tag_tag_id_seq OWNED BY public.tag.tag_id;
--
-- Name: user_account; Type: TABLE; Schema: public; Owner: devasia
--
CREATE TABLE public.user_account (
user_account_id integer NOT NULL,
phone character varying(20) NOT NULL,
email character varying(355) DEFAULT ''::character varying NOT NULL,
password character varying(1024) NOT NULL,
full_name character varying(250) DEFAULT ''::character varying NOT NULL,
active boolean DEFAULT false NOT NULL,
created_on timestamp without time zone NOT NULL,
last_login timestamp without time zone
);
ALTER TABLE public.user_account OWNER TO devasia;
--
-- Name: user_account_user_account_id_seq; Type: SEQUENCE; Schema: public; Owner: devasia
--
CREATE SEQUENCE public.user_account_user_account_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.user_account_user_account_id_seq OWNER TO devasia;
--
-- Name: user_account_user_account_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: devasia
--
ALTER SEQUENCE public.user_account_user_account_id_seq OWNED BY public.user_account.user_account_id;
--
-- Name: user_session; Type: TABLE; Schema: public; Owner: devasia
--
CREATE TABLE public.user_session (
user_session_id integer NOT NULL,
user_account_id integer NOT NULL,
auth_token character varying(64),
session_expiry timestamp without time zone NOT NULL
);
ALTER TABLE public.user_session OWNER TO devasia;
--
-- Name: user_session_user_session_id_seq; Type: SEQUENCE; Schema: public; Owner: devasia
--
CREATE SEQUENCE public.user_session_user_session_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.user_session_user_session_id_seq OWNER TO devasia;
--
-- Name: user_session_user_session_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: devasia
--
ALTER SEQUENCE public.user_session_user_session_id_seq OWNED BY public.user_session.user_session_id;
--
-- Name: blog blog_id; Type: DEFAULT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.blog ALTER COLUMN blog_id SET DEFAULT nextval('public.blog_blog_id_seq'::regclass);
--
-- Name: blog_tag blog_tag_id; Type: DEFAULT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.blog_tag ALTER COLUMN blog_tag_id SET DEFAULT nextval('public.blog_tag_blog_tag_id_seq'::regclass);
--
-- Name: domain domain_id; Type: DEFAULT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.domain ALTER COLUMN domain_id SET DEFAULT nextval('public.domain_domain_id_seq'::regclass);
--
-- Name: domain_user_role role_id; Type: DEFAULT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.domain_user_role ALTER COLUMN role_id SET DEFAULT nextval('public.domain_user_role_role_id_seq'::regclass);
--
-- Name: page page_id; Type: DEFAULT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.page ALTER COLUMN page_id SET DEFAULT nextval('public.page_page_id_seq'::regclass);
--
-- Name: tag tag_id; Type: DEFAULT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.tag ALTER COLUMN tag_id SET DEFAULT nextval('public.tag_tag_id_seq'::regclass);
--
-- Name: user_account user_account_id; Type: DEFAULT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.user_account ALTER COLUMN user_account_id SET DEFAULT nextval('public.user_account_user_account_id_seq'::regclass);
--
-- Name: user_session user_session_id; Type: DEFAULT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.user_session ALTER COLUMN user_session_id SET DEFAULT nextval('public.user_session_user_session_id_seq'::regclass);
--
-- Data for Name: blog; Type: TABLE DATA; Schema: public; Owner: devasia
--
COPY public.blog (blog_id, blog_type, blog_title, blog_markdown, blog_html, blog_slug, created, last_edited, domain_id) FROM stdin;
\.
--
-- Data for Name: blog_tag; Type: TABLE DATA; Schema: public; Owner: devasia
--
COPY public.blog_tag (blog_tag_id, blog_id, tag_id) FROM stdin;
\.
--
-- Data for Name: domain; Type: TABLE DATA; Schema: public; Owner: devasia
--
COPY public.domain (domain_id, domain_name, domain_dir) FROM stdin;
1 localhost localhost
2 palathrainfra.com palathrainfra.com
3 wemebox.com wemebox.com
4 centipair.com centipair.com
5 clearwayfacility.com clearwayfacility.com
\.
--
-- Data for Name: domain_user_role; Type: TABLE DATA; Schema: public; Owner: devasia
--
COPY public.domain_user_role (role_id, role, user_account_id, domain_id) FROM stdin;
\.
--
-- Data for Name: page; Type: TABLE DATA; Schema: public; Owner: devasia
--
COPY public.page (page_id, page_slug, page_file, base_page_file, domain_id) FROM stdin;
1 home home.html base.html 1
2 home home.html base.html 2
3 about about.html base.html 2
4 contact contact.html base.html 2
5 our-business our-business.html base.html 2
6 services services.html base.html 2
7 projects projects.html base.html 2
8 home home.html base.html 3
9 home home.html base.html 4
10 home home.html base.html 5
11 about about.html base.html 5
12 contact contact.html base.html 5
\.
--
-- Data for Name: tag; Type: TABLE DATA; Schema: public; Owner: devasia
--
COPY public.tag (tag_id, tag_name) FROM stdin;
\.
--
-- Data for Name: user_account; Type: TABLE DATA; Schema: public; Owner: devasia
--
COPY public.user_account (user_account_id, phone, email, password, full_name, active, created_on, last_login) FROM stdin;
\.
--
-- Data for Name: user_session; Type: TABLE DATA; Schema: public; Owner: devasia
--
COPY public.user_session (user_session_id, user_account_id, auth_token, session_expiry) FROM stdin;
\.
--
-- Name: blog_blog_id_seq; Type: SEQUENCE SET; Schema: public; Owner: devasia
--
SELECT pg_catalog.setval('public.blog_blog_id_seq', 1, false);
--
-- Name: blog_tag_blog_tag_id_seq; Type: SEQUENCE SET; Schema: public; Owner: devasia
--
SELECT pg_catalog.setval('public.blog_tag_blog_tag_id_seq', 1, false);
--
-- Name: domain_domain_id_seq; Type: SEQUENCE SET; Schema: public; Owner: devasia
--
SELECT pg_catalog.setval('public.domain_domain_id_seq', 5, true);
--
-- Name: domain_user_role_role_id_seq; Type: SEQUENCE SET; Schema: public; Owner: devasia
--
SELECT pg_catalog.setval('public.domain_user_role_role_id_seq', 1, false);
--
-- Name: page_page_id_seq; Type: SEQUENCE SET; Schema: public; Owner: devasia
--
SELECT pg_catalog.setval('public.page_page_id_seq', 12, true);
--
-- Name: tag_tag_id_seq; Type: SEQUENCE SET; Schema: public; Owner: devasia
--
SELECT pg_catalog.setval('public.tag_tag_id_seq', 1, false);
--
-- Name: user_account_user_account_id_seq; Type: SEQUENCE SET; Schema: public; Owner: devasia
--
SELECT pg_catalog.setval('public.user_account_user_account_id_seq', 1, false);
--
-- Name: user_session_user_session_id_seq; Type: SEQUENCE SET; Schema: public; Owner: devasia
--
SELECT pg_catalog.setval('public.user_session_user_session_id_seq', 1, false);
--
-- Name: blog blog_pkey; Type: CONSTRAINT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.blog
ADD CONSTRAINT blog_pkey PRIMARY KEY (blog_id);
--
-- Name: blog_tag blog_tag_blog_id_tag_id_key; Type: CONSTRAINT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.blog_tag
ADD CONSTRAINT blog_tag_blog_id_tag_id_key UNIQUE (blog_id, tag_id);
--
-- Name: blog_tag blog_tag_pkey; Type: CONSTRAINT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.blog_tag
ADD CONSTRAINT blog_tag_pkey PRIMARY KEY (blog_tag_id);
--
-- Name: domain domain_pkey; Type: CONSTRAINT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.domain
ADD CONSTRAINT domain_pkey PRIMARY KEY (domain_id);
--
-- Name: domain_user_role domain_user_role_pkey; Type: CONSTRAINT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.domain_user_role
ADD CONSTRAINT domain_user_role_pkey PRIMARY KEY (role_id);
--
-- Name: page page_pkey; Type: CONSTRAINT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.page
ADD CONSTRAINT page_pkey PRIMARY KEY (page_id);
--
-- Name: tag tag_pkey; Type: CONSTRAINT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.tag
ADD CONSTRAINT tag_pkey PRIMARY KEY (tag_id);
--
-- Name: tag tag_tag_name_key; Type: CONSTRAINT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.tag
ADD CONSTRAINT tag_tag_name_key UNIQUE (tag_name);
--
-- Name: user_account user_account_email_key; Type: CONSTRAINT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.user_account
ADD CONSTRAINT user_account_email_key UNIQUE (email);
--
-- Name: user_account user_account_phone_key; Type: CONSTRAINT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.user_account
ADD CONSTRAINT user_account_phone_key UNIQUE (phone);
--
-- Name: user_account user_account_pkey; Type: CONSTRAINT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.user_account
ADD CONSTRAINT user_account_pkey PRIMARY KEY (user_account_id);
--
-- Name: user_session user_session_pkey; Type: CONSTRAINT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.user_session
ADD CONSTRAINT user_session_pkey PRIMARY KEY (user_session_id);
--
-- Name: blog blog_domain_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.blog
ADD CONSTRAINT blog_domain_id_fkey FOREIGN KEY (domain_id) REFERENCES public.domain(domain_id) ON DELETE CASCADE;
--
-- Name: blog_tag blog_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.blog_tag
ADD CONSTRAINT blog_id_fkey FOREIGN KEY (blog_id) REFERENCES public.blog(blog_id) ON DELETE CASCADE;
--
-- Name: domain_user_role domain_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.domain_user_role
ADD CONSTRAINT domain_id_fkey FOREIGN KEY (domain_id) REFERENCES public.domain(domain_id) ON DELETE CASCADE;
--
-- Name: page page_domain_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.page
ADD CONSTRAINT page_domain_id_fkey FOREIGN KEY (domain_id) REFERENCES public.domain(domain_id) ON DELETE CASCADE;
--
-- Name: blog_tag tag_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.blog_tag
ADD CONSTRAINT tag_id_fkey FOREIGN KEY (tag_id) REFERENCES public.tag(tag_id) ON DELETE CASCADE;
--
-- Name: domain_user_role user_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.domain_user_role
ADD CONSTRAINT user_account_id_fkey FOREIGN KEY (user_account_id) REFERENCES public.user_account(user_account_id) ON DELETE CASCADE;
--
-- Name: user_session user_session_user_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: devasia
--
ALTER TABLE ONLY public.user_session
ADD CONSTRAINT user_session_user_account_id_fkey FOREIGN KEY (user_account_id) REFERENCES public.user_account(user_account_id) ON DELETE CASCADE;
--
-- PostgreSQL database dump complete
--