-
Notifications
You must be signed in to change notification settings - Fork 0
/
dump.sql
313 lines (203 loc) · 6.19 KB
/
dump.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
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: madefor; Type: TABLE; Schema: public; Owner: addy; Tablespace:
--
CREATE TABLE madefor (
mid integer NOT NULL,
purch_id integer,
prod_id integer,
qnty numeric
);
ALTER TABLE public.madefor OWNER TO addy;
--
-- Name: madefor_mid_seq; Type: SEQUENCE; Schema: public; Owner: addy
--
CREATE SEQUENCE madefor_mid_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.madefor_mid_seq OWNER TO addy;
--
-- Name: madefor_mid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: addy
--
ALTER SEQUENCE madefor_mid_seq OWNED BY madefor.mid;
--
-- Name: madefor_mid_seq; Type: SEQUENCE SET; Schema: public; Owner: addy
--
SELECT pg_catalog.setval('madefor_mid_seq', 1, false);
--
-- Name: product; Type: TABLE; Schema: public; Owner: addy; Tablespace:
--
CREATE TABLE product (
prodid integer NOT NULL,
prodname character varying(30),
price real,
description character varying(500),
qty numeric,
date timestamp without time zone
);
ALTER TABLE public.product OWNER TO addy;
--
-- Name: product_prodid_seq; Type: SEQUENCE; Schema: public; Owner: addy
--
CREATE SEQUENCE product_prodid_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.product_prodid_seq OWNER TO addy;
--
-- Name: product_prodid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: addy
--
ALTER SEQUENCE product_prodid_seq OWNED BY product.prodid;
--
-- Name: product_prodid_seq; Type: SEQUENCE SET; Schema: public; Owner: addy
--
SELECT pg_catalog.setval('product_prodid_seq', 1, true);
--
-- Name: purchase; Type: TABLE; Schema: public; Owner: addy; Tablespace:
--
CREATE TABLE purchase (
purchid integer NOT NULL,
timestmp timestamp without time zone,
total real,
user_id integer
);
ALTER TABLE public.purchase OWNER TO addy;
--
-- Name: purchase_purchid_seq; Type: SEQUENCE; Schema: public; Owner: addy
--
CREATE SEQUENCE purchase_purchid_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.purchase_purchid_seq OWNER TO addy;
--
-- Name: purchase_purchid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: addy
--
ALTER SEQUENCE purchase_purchid_seq OWNED BY purchase.purchid;
--
-- Name: purchase_purchid_seq; Type: SEQUENCE SET; Schema: public; Owner: addy
--
SELECT pg_catalog.setval('purchase_purchid_seq', 1, false);
--
-- Name: users; Type: TABLE; Schema: public; Owner: addy; Tablespace:
--
CREATE TABLE users (
userid integer NOT NULL,
fname character varying(30),
lname character varying(30),
phone_no numeric,
email_id character varying(30),
password character varying(300),
regdate date,
perm character varying(20)
);
ALTER TABLE public.users OWNER TO addy;
--
-- Name: users_userid_seq; Type: SEQUENCE; Schema: public; Owner: addy
--
CREATE SEQUENCE users_userid_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.users_userid_seq OWNER TO addy;
--
-- Name: users_userid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: addy
--
ALTER SEQUENCE users_userid_seq OWNED BY users.userid;
--
-- Name: users_userid_seq; Type: SEQUENCE SET; Schema: public; Owner: addy
--
SELECT pg_catalog.setval('users_userid_seq', 1, true);
--
-- Name: mid; Type: DEFAULT; Schema: public; Owner: addy
--
ALTER TABLE ONLY madefor ALTER COLUMN mid SET DEFAULT nextval('madefor_mid_seq'::regclass);
--
-- Name: prodid; Type: DEFAULT; Schema: public; Owner: addy
--
ALTER TABLE ONLY product ALTER COLUMN prodid SET DEFAULT nextval('product_prodid_seq'::regclass);
--
-- Name: purchid; Type: DEFAULT; Schema: public; Owner: addy
--
ALTER TABLE ONLY purchase ALTER COLUMN purchid SET DEFAULT nextval('purchase_purchid_seq'::regclass);
--
-- Name: userid; Type: DEFAULT; Schema: public; Owner: addy
--
ALTER TABLE ONLY users ALTER COLUMN userid SET DEFAULT nextval('users_userid_seq'::regclass);
--
-- Data for Name: madefor; Type: TABLE DATA; Schema: public; Owner: addy
--
--
-- Data for Name: product; Type: TABLE DATA; Schema: public; Owner: addy
--
--
-- Data for Name: purchase; Type: TABLE DATA; Schema: public; Owner: addy
--
--
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: addy
--
INSERT INTO users VALUES (1, 'Addy', 'Singh', 8888888888, 'addy689@gmail.com', 'e10adc3949ba59abbe56e057f20f883e', '2012-04-18', 'admin');
--
-- Name: madefor_pkey; Type: CONSTRAINT; Schema: public; Owner: addy; Tablespace:
--
ALTER TABLE ONLY madefor
ADD CONSTRAINT madefor_pkey PRIMARY KEY (mid);
--
-- Name: product_pkey; Type: CONSTRAINT; Schema: public; Owner: addy; Tablespace:
--
ALTER TABLE ONLY product
ADD CONSTRAINT product_pkey PRIMARY KEY (prodid);
--
-- Name: purchase_pkey; Type: CONSTRAINT; Schema: public; Owner: addy; Tablespace:
--
ALTER TABLE ONLY purchase
ADD CONSTRAINT purchase_pkey PRIMARY KEY (purchid);
--
-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: addy; Tablespace:
--
ALTER TABLE ONLY users
ADD CONSTRAINT users_pkey PRIMARY KEY (userid);
--
-- Name: UserId; Type: FK CONSTRAINT; Schema: public; Owner: addy
--
ALTER TABLE ONLY purchase
ADD CONSTRAINT "UserId" FOREIGN KEY (user_id) REFERENCES users(userid);
--
-- Name: madefor_prod_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: addy
--
ALTER TABLE ONLY madefor
ADD CONSTRAINT madefor_prod_id_fkey FOREIGN KEY (prod_id) REFERENCES product(prodid);
--
-- Name: madefor_purch_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: addy
--
ALTER TABLE ONLY madefor
ADD CONSTRAINT madefor_purch_id_fkey FOREIGN KEY (purch_id) REFERENCES purchase(purchid);
--
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;
--
-- PostgreSQL database dump complete
--