-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
741 lines (497 loc) · 16.7 KB
/
Copy pathschema.sql
File metadata and controls
741 lines (497 loc) · 16.7 KB
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
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
--
-- PostgreSQL database dump
--
-- Dumped from database version 17.4
-- Dumped by pg_dump version 17.4
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET transaction_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;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: cache; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.cache (
key character varying(255) NOT NULL,
value text NOT NULL,
expiration integer NOT NULL
);
ALTER TABLE public.cache OWNER TO postgres;
--
-- Name: cache_locks; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.cache_locks (
key character varying(255) NOT NULL,
owner character varying(255) NOT NULL,
expiration integer NOT NULL
);
ALTER TABLE public.cache_locks OWNER TO postgres;
--
-- Name: failed_jobs; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.failed_jobs (
id bigint NOT NULL,
uuid character varying(255) NOT NULL,
connection text NOT NULL,
queue text NOT NULL,
payload text NOT NULL,
exception text NOT NULL,
failed_at timestamp(0) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);
ALTER TABLE public.failed_jobs OWNER TO postgres;
--
-- Name: failed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.failed_jobs_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.failed_jobs_id_seq OWNER TO postgres;
--
-- Name: failed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.failed_jobs_id_seq OWNED BY public.failed_jobs.id;
--
-- Name: in_shopping_cart; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.in_shopping_cart (
id bigint NOT NULL,
user_id bigint,
product_id bigint NOT NULL,
amount integer DEFAULT 1 NOT NULL,
session_id character varying(255)
);
ALTER TABLE public.in_shopping_cart OWNER TO postgres;
--
-- Name: in_shopping_cart_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.in_shopping_cart_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.in_shopping_cart_id_seq OWNER TO postgres;
--
-- Name: in_shopping_cart_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.in_shopping_cart_id_seq OWNED BY public.in_shopping_cart.id;
--
-- Name: job_batches; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.job_batches (
id character varying(255) NOT NULL,
name character varying(255) NOT NULL,
total_jobs integer NOT NULL,
pending_jobs integer NOT NULL,
failed_jobs integer NOT NULL,
failed_job_ids text NOT NULL,
options text,
cancelled_at integer,
created_at integer NOT NULL,
finished_at integer
);
ALTER TABLE public.job_batches OWNER TO postgres;
--
-- Name: jobs; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.jobs (
id bigint NOT NULL,
queue character varying(255) NOT NULL,
payload text NOT NULL,
attempts smallint NOT NULL,
reserved_at integer,
available_at integer NOT NULL,
created_at integer NOT NULL
);
ALTER TABLE public.jobs OWNER TO postgres;
--
-- Name: jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.jobs_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.jobs_id_seq OWNER TO postgres;
--
-- Name: jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.jobs_id_seq OWNED BY public.jobs.id;
--
-- Name: migrations; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.migrations (
id integer NOT NULL,
migration character varying(255) NOT NULL,
batch integer NOT NULL
);
ALTER TABLE public.migrations OWNER TO postgres;
--
-- Name: migrations_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.migrations_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.migrations_id_seq OWNER TO postgres;
--
-- Name: migrations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.migrations_id_seq OWNED BY public.migrations.id;
--
-- Name: order_items; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.order_items (
id bigint NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);
ALTER TABLE public.order_items OWNER TO postgres;
--
-- Name: order_items_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.order_items_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.order_items_id_seq OWNER TO postgres;
--
-- Name: order_items_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.order_items_id_seq OWNED BY public.order_items.id;
--
-- Name: orders; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.orders (
id bigint NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);
ALTER TABLE public.orders OWNER TO postgres;
--
-- Name: orders_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.orders_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.orders_id_seq OWNER TO postgres;
--
-- Name: orders_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.orders_id_seq OWNED BY public.orders.id;
--
-- Name: password_reset_tokens; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.password_reset_tokens (
email character varying(255) NOT NULL,
token character varying(255) NOT NULL,
created_at timestamp(0) without time zone
);
ALTER TABLE public.password_reset_tokens OWNER TO postgres;
--
-- Name: product_categories; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.product_categories (
id bigint NOT NULL,
name character varying(255) NOT NULL,
category_type character varying(255) NOT NULL
);
ALTER TABLE public.product_categories OWNER TO postgres;
--
-- Name: product_categories_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.product_categories_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.product_categories_id_seq OWNER TO postgres;
--
-- Name: product_categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.product_categories_id_seq OWNED BY public.product_categories.id;
--
-- Name: product_tags; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.product_tags (
id bigint NOT NULL,
product_id bigint NOT NULL,
product_category_id bigint NOT NULL
);
ALTER TABLE public.product_tags OWNER TO postgres;
--
-- Name: product_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.product_tags_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.product_tags_id_seq OWNER TO postgres;
--
-- Name: product_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.product_tags_id_seq OWNED BY public.product_tags.id;
--
-- Name: products; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.products (
id bigint NOT NULL,
name character varying(255) NOT NULL,
image_url character varying(255) NOT NULL,
additional_images json,
description text NOT NULL,
price double precision NOT NULL,
created_at timestamp(0) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
in_stock integer NOT NULL
);
ALTER TABLE public.products OWNER TO postgres;
--
-- Name: products_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.products_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.products_id_seq OWNER TO postgres;
--
-- Name: products_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.products_id_seq OWNED BY public.products.id;
--
-- Name: sessions; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.sessions (
id character varying(255) NOT NULL,
user_id bigint,
ip_address character varying(45),
user_agent text,
payload text NOT NULL,
last_activity integer NOT NULL
);
ALTER TABLE public.sessions OWNER TO postgres;
--
-- Name: users; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.users (
id bigint NOT NULL,
name character varying(255),
email character varying(255),
email_verified_at timestamp(0) without time zone,
password character varying(255),
full_name character varying(255),
address character varying(255),
city character varying(255),
postal_code character varying(255),
country character varying(255),
is_admin boolean DEFAULT false NOT NULL,
remember_token character varying(100),
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);
ALTER TABLE public.users OWNER TO postgres;
--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.users_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.users_id_seq OWNER TO postgres;
--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
--
-- Name: failed_jobs id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.failed_jobs ALTER COLUMN id SET DEFAULT nextval('public.failed_jobs_id_seq'::regclass);
--
-- Name: in_shopping_cart id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.in_shopping_cart ALTER COLUMN id SET DEFAULT nextval('public.in_shopping_cart_id_seq'::regclass);
--
-- Name: jobs id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.jobs ALTER COLUMN id SET DEFAULT nextval('public.jobs_id_seq'::regclass);
--
-- Name: migrations id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.migrations ALTER COLUMN id SET DEFAULT nextval('public.migrations_id_seq'::regclass);
--
-- Name: order_items id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.order_items ALTER COLUMN id SET DEFAULT nextval('public.order_items_id_seq'::regclass);
--
-- Name: orders id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.orders ALTER COLUMN id SET DEFAULT nextval('public.orders_id_seq'::regclass);
--
-- Name: product_categories id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.product_categories ALTER COLUMN id SET DEFAULT nextval('public.product_categories_id_seq'::regclass);
--
-- Name: product_tags id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.product_tags ALTER COLUMN id SET DEFAULT nextval('public.product_tags_id_seq'::regclass);
--
-- Name: products id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.products ALTER COLUMN id SET DEFAULT nextval('public.products_id_seq'::regclass);
--
-- Name: users id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
--
-- Name: cache_locks cache_locks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.cache_locks
ADD CONSTRAINT cache_locks_pkey PRIMARY KEY (key);
--
-- Name: cache cache_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.cache
ADD CONSTRAINT cache_pkey PRIMARY KEY (key);
--
-- Name: failed_jobs failed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.failed_jobs
ADD CONSTRAINT failed_jobs_pkey PRIMARY KEY (id);
--
-- Name: failed_jobs failed_jobs_uuid_unique; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.failed_jobs
ADD CONSTRAINT failed_jobs_uuid_unique UNIQUE (uuid);
--
-- Name: in_shopping_cart in_shopping_cart_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.in_shopping_cart
ADD CONSTRAINT in_shopping_cart_pkey PRIMARY KEY (id);
--
-- Name: job_batches job_batches_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.job_batches
ADD CONSTRAINT job_batches_pkey PRIMARY KEY (id);
--
-- Name: jobs jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.jobs
ADD CONSTRAINT jobs_pkey PRIMARY KEY (id);
--
-- Name: migrations migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.migrations
ADD CONSTRAINT migrations_pkey PRIMARY KEY (id);
--
-- Name: order_items order_items_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.order_items
ADD CONSTRAINT order_items_pkey PRIMARY KEY (id);
--
-- Name: orders orders_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.orders
ADD CONSTRAINT orders_pkey PRIMARY KEY (id);
--
-- Name: password_reset_tokens password_reset_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.password_reset_tokens
ADD CONSTRAINT password_reset_tokens_pkey PRIMARY KEY (email);
--
-- Name: product_categories product_categories_name_unique; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.product_categories
ADD CONSTRAINT product_categories_name_unique UNIQUE (name);
--
-- Name: product_categories product_categories_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.product_categories
ADD CONSTRAINT product_categories_pkey PRIMARY KEY (id);
--
-- Name: product_tags product_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.product_tags
ADD CONSTRAINT product_tags_pkey PRIMARY KEY (id);
--
-- Name: products products_name_unique; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.products
ADD CONSTRAINT products_name_unique UNIQUE (name);
--
-- Name: products products_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.products
ADD CONSTRAINT products_pkey PRIMARY KEY (id);
--
-- Name: sessions sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.sessions
ADD CONSTRAINT sessions_pkey PRIMARY KEY (id);
--
-- Name: users users_email_unique; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_email_unique UNIQUE (email);
--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
--
-- Name: jobs_queue_index; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX jobs_queue_index ON public.jobs USING btree (queue);
--
-- Name: product_categories_category_type_index; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX product_categories_category_type_index ON public.product_categories USING btree (category_type);
--
-- Name: product_tags_product_category_id_index; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX product_tags_product_category_id_index ON public.product_tags USING btree (product_category_id);
--
-- Name: product_tags_product_id_index; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX product_tags_product_id_index ON public.product_tags USING btree (product_id);
--
-- Name: sessions_last_activity_index; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX sessions_last_activity_index ON public.sessions USING btree (last_activity);
--
-- Name: sessions_user_id_index; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX sessions_user_id_index ON public.sessions USING btree (user_id);
--
-- Name: in_shopping_cart in_shopping_cart_product_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.in_shopping_cart
ADD CONSTRAINT in_shopping_cart_product_id_foreign FOREIGN KEY (product_id) REFERENCES public.products(id) ON DELETE CASCADE;
--
-- PostgreSQL database dump complete
--