· 9 years ago · Apr 07, 2017, 07:32 AM
1/*
2 Navicat Premium Data Transfer
3
4 Source Server : IPCAM
5 Source Server Type : PostgreSQL
6 Source Server Version : 90405
7 Source Host : localhost
8 Source Database : trex
9 Source Schema : public
10
11 Target Server Type : PostgreSQL
12 Target Server Version : 90405
13 File Encoding : utf-8
14
15 Date: 04/07/2017 10:04:45 AM
16*/
17
18-- ----------------------------
19-- Sequence structure for accounts_id_seq
20-- ----------------------------
21DROP SEQUENCE IF EXISTS "accounts_id_seq";
22CREATE SEQUENCE "accounts_id_seq" INCREMENT 1 START 3 MAXVALUE 9223372036854775807 MINVALUE 1 CACHE 1;
23ALTER TABLE "accounts_id_seq" OWNER TO "postgres";
24
25-- ----------------------------
26-- Sequence structure for authors_id_seq
27-- ----------------------------
28DROP SEQUENCE IF EXISTS "authors_id_seq";
29CREATE SEQUENCE "authors_id_seq" INCREMENT 1 START 6 MAXVALUE 9223372036854775807 MINVALUE 1 CACHE 1;
30ALTER TABLE "authors_id_seq" OWNER TO "postgres";
31
32-- ----------------------------
33-- Sequence structure for books_id_seq
34-- ----------------------------
35DROP SEQUENCE IF EXISTS "books_id_seq";
36CREATE SEQUENCE "books_id_seq" INCREMENT 1 START 9 MAXVALUE 9223372036854775807 MINVALUE 1 CACHE 1;
37ALTER TABLE "books_id_seq" OWNER TO "postgres";
38
39-- ----------------------------
40-- Sequence structure for carts_id_seq
41-- ----------------------------
42DROP SEQUENCE IF EXISTS "carts_id_seq";
43CREATE SEQUENCE "carts_id_seq" INCREMENT 1 START 36 MAXVALUE 9223372036854775807 MINVALUE 1 CACHE 1;
44ALTER TABLE "carts_id_seq" OWNER TO "postgres";
45
46-- ----------------------------
47-- Sequence structure for categories_id_seq
48-- ----------------------------
49DROP SEQUENCE IF EXISTS "categories_id_seq";
50CREATE SEQUENCE "categories_id_seq" INCREMENT 1 START 8 MAXVALUE 9223372036854775807 MINVALUE 1 CACHE 1;
51ALTER TABLE "categories_id_seq" OWNER TO "postgres";
52
53-- ----------------------------
54-- Sequence structure for checkout_detail_id_seq
55-- ----------------------------
56DROP SEQUENCE IF EXISTS "checkout_detail_id_seq";
57CREATE SEQUENCE "checkout_detail_id_seq" INCREMENT 1 START 2 MAXVALUE 9223372036854775807 MINVALUE 1 CACHE 1;
58ALTER TABLE "checkout_detail_id_seq" OWNER TO "postgres";
59
60-- ----------------------------
61-- Sequence structure for checkouts_id_seq
62-- ----------------------------
63DROP SEQUENCE IF EXISTS "checkouts_id_seq";
64CREATE SEQUENCE "checkouts_id_seq" INCREMENT 1 START 2 MAXVALUE 9223372036854775807 MINVALUE 1 CACHE 1;
65ALTER TABLE "checkouts_id_seq" OWNER TO "postgres";
66
67-- ----------------------------
68-- Sequence structure for user_profile_id_seq
69-- ----------------------------
70DROP SEQUENCE IF EXISTS "user_profile_id_seq";
71CREATE SEQUENCE "user_profile_id_seq" INCREMENT 1 START 1 MAXVALUE 9223372036854775807 MINVALUE 1 CACHE 1;
72ALTER TABLE "user_profile_id_seq" OWNER TO "postgres";
73
74-- ----------------------------
75-- Sequence structure for who_we_are_id_seq
76-- ----------------------------
77DROP SEQUENCE IF EXISTS "who_we_are_id_seq";
78CREATE SEQUENCE "who_we_are_id_seq" INCREMENT 1 START 1 MAXVALUE 9223372036854775807 MINVALUE 1 CACHE 1;
79ALTER TABLE "who_we_are_id_seq" OWNER TO "postgres";
80
81-- ----------------------------
82-- Table structure for accounts
83-- ----------------------------
84DROP TABLE IF EXISTS "accounts";
85CREATE TABLE "accounts" (
86 "id" int4 NOT NULL DEFAULT nextval('accounts_id_seq'::regclass),
87 "email" varchar(255) COLLATE "default",
88 "password" text COLLATE "default",
89 "role" int4,
90 "status" bool NOT NULL DEFAULT false,
91 "inserted_at" timestamp(6) NOT NULL,
92 "updated_at" timestamp(6) NOT NULL
93)
94WITH (OIDS=FALSE);
95ALTER TABLE "accounts" OWNER TO "postgres";
96
97-- ----------------------------
98-- Records of accounts
99-- ----------------------------
100BEGIN;
101INSERT INTO "accounts" VALUES ('2', 'dara@gmail.com', '$2b$12$YBCKQ/ivzYgxBioWIuoKp.rsgcic/3T7ZttCv60I2gKbEPc5NeF5a', '1', 't', '2017-04-01 14:59:25.080884', '2017-04-01 14:59:25.080899');
102INSERT INTO "accounts" VALUES ('1', 'thanak@gmail.com', '$2b$12$YBCKQ/ivzYgxBioWIuoKp.rsgcic/3T7ZttCv60I2gKbEPc5NeF5a', '1', 't', '2017-10-02 00:00:00', '2017-12-03 00:00:00');
103INSERT INTO "accounts" VALUES ('3', 'thay@gmail.com', '$2b$12$nahMeo8KY/zfGwDndEtxluXglKbfCVdS22KIJ2w3RHHzI1qOCLVKa', '1', 't', '2017-04-05 14:40:31.751864', '2017-04-05 14:40:31.978565');
104COMMIT;
105
106-- ----------------------------
107-- Table structure for authors
108-- ----------------------------
109DROP TABLE IF EXISTS "authors";
110CREATE TABLE "authors" (
111 "id" int4 NOT NULL DEFAULT nextval('authors_id_seq'::regclass),
112 "firstname" varchar(255) COLLATE "default",
113 "lastname" varchar(255) COLLATE "default",
114 "position" varchar(255) COLLATE "default",
115 "description" text COLLATE "default",
116 "photo" text COLLATE "default",
117 "status" bool NOT NULL DEFAULT false,
118 "inserted_at" timestamp(6) NOT NULL,
119 "updated_at" timestamp(6) NOT NULL
120)
121WITH (OIDS=FALSE);
122ALTER TABLE "authors" OWNER TO "postgres";
123
124-- ----------------------------
125-- Records of authors
126-- ----------------------------
127BEGIN;
128INSERT INTO "authors" VALUES ('4', 'Barac ', 'Obama', 'Priminister', 'Priminister of USA', '4c8ac96a-19a7-11e7-87b7-e0db559fd419.jpg', 't', '2017-04-05 02:26:39.249539', '2017-04-05 02:26:39.249553');
129INSERT INTO "authors" VALUES ('5', 'Warrent ', 'Buffet', 'good', 'good', '59f598d2-19a7-11e7-9499-e0db559fd419.jpg', 't', '2017-04-05 02:27:01.759579', '2017-04-05 02:27:01.759591');
130INSERT INTO "authors" VALUES ('3', 'kelvin', 'klen1', 'author', 'good', '36b68548-19b1-11e7-9367-e0db559fd419.jpg', 't', '2017-04-05 02:22:54.255188', '2017-04-05 03:37:37.634103');
131COMMIT;
132
133-- ----------------------------
134-- Table structure for books
135-- ----------------------------
136DROP TABLE IF EXISTS "books";
137CREATE TABLE "books" (
138 "id" int4 NOT NULL DEFAULT nextval('books_id_seq'::regclass),
139 "title" varchar(255) COLLATE "default",
140 "isbn" varchar(255) COLLATE "default",
141 "price" float8,
142 "unit" int4,
143 "publisher_name" varchar(255) COLLATE "default",
144 "published_year" varchar(255) COLLATE "default",
145 "page_count" varchar(255) COLLATE "default",
146 "language" varchar(255) COLLATE "default",
147 "shipping_weight" float8,
148 "book_dimensions" varchar(255) COLLATE "default",
149 "status" int4,
150 "image" text COLLATE "default",
151 "description" text COLLATE "default",
152 "author_name" varchar(255) COLLATE "default",
153 "is_feature" bool NOT NULL DEFAULT false,
154 "category_id" int4,
155 "author_id" int4,
156 "inserted_at" timestamp(6) NOT NULL,
157 "updated_at" timestamp(6) NOT NULL
158)
159WITH (OIDS=FALSE);
160ALTER TABLE "books" OWNER TO "postgres";
161
162-- ----------------------------
163-- Records of books
164-- ----------------------------
165BEGIN;
166INSERT INTO "books" VALUES ('1', 'Barac Obama', '344552', '21', '23', 'Kevin', '2013', '23', 'en', '234', '23', '1', 'd25b3a28-1913-11e7-aa75-e0db559fd419.jpg', 'good in comment', 'Stev Job', 't', '5', '1', '2017-04-04 08:50:58.431822', '2017-04-04 08:50:58.445931');
167INSERT INTO "books" VALUES ('4', 'Barac Obama', '1234', '21', '12', 'Barac Obama', '2013', '234', 'en', '21', '45', '1', '5cc8633e-1914-11e7-90e5-e0db559fd419.jpg', 'good in stock', 'Stev Job', 't', '7', '1', '2017-04-04 08:54:50.479015', '2017-04-04 08:54:50.479026');
168INSERT INTO "books" VALUES ('5', 'The speed of though', '12345', '21', '213', 'Bill', '2012', '234', 'en', '12', '2', '1', '84107e18-1914-11e7-9a07-e0db559fd419.jpg', 'good condition', 'Bill Gate', 'f', '6', '2', '2017-04-04 08:55:56.387071', '2017-04-04 08:55:56.387097');
169INSERT INTO "books" VALUES ('3', 'Stev Job', '123', '32', '0', 'Stev Job', '2013', '123', 'en', '34', '34', '1', '22814344-1914-11e7-b2f9-e0db559fd419.jpg', 'good in comment', 'Stev Job', 't', '5', '1', '2017-04-04 08:53:12.706405', '2017-04-04 14:02:46.670792');
170INSERT INTO "books" VALUES ('8', 'Tap dance', '23445', '23', '43', 'Kid ', '2013', '23', 'en', '12', '23', '1', '0ce08882-1915-11e7-ac34-e0db559fd419.jpg', 'for bussiness', 'Stev Job', 'f', '5', '1', '2017-04-04 08:59:45.915546', '2017-04-05 03:45:56.94916');
171INSERT INTO "books" VALUES ('7', 'Security Analysis', '1234', '21', '30', 'King vay', '2012', '123', 'en', '13', '34', '1', 'd4c5b53a-1914-11e7-b957-e0db559fd419.jpg', 'gepedia care', 'Stev Job', 'f', '5', '1', '2017-04-04 08:58:11.797465', '2017-04-05 03:47:39.763147');
172INSERT INTO "books" VALUES ('2', 'Bill Gate Book', '4555555', '4', '42', 'Bill Gate', '2015', '32', 'en', '1', '44', '1', 'f98cded0-1913-11e7-8989-e0db559fd419.jpg', 'good in stock', 'Bill Gate', 't', '7', '2', '2017-04-04 08:52:03.994331', '2017-04-05 07:06:38.972877');
173INSERT INTO "books" VALUES ('9', 'The road a head', '12345', '21', '31', 'dARA', '2014', '34', 'en', '43', '43', '1', 'd0a8aa06-19ce-11e7-957e-e0db559fd419.jpg', 'ddfff', 'Barac Obama', 'f', '5', '4', '2017-04-05 07:09:31.445709', '2017-04-06 06:29:44.348993');
174COMMIT;
175
176-- ----------------------------
177-- Table structure for carts
178-- ----------------------------
179DROP TABLE IF EXISTS "carts";
180CREATE TABLE "carts" (
181 "id" int4 NOT NULL DEFAULT nextval('carts_id_seq'::regclass),
182 "price" float8,
183 "unit" int4,
184 "status" int4,
185 "account_id" int4,
186 "book_id" int4,
187 "inserted_at" timestamp(6) NOT NULL,
188 "updated_at" timestamp(6) NOT NULL
189)
190WITH (OIDS=FALSE);
191ALTER TABLE "carts" OWNER TO "postgres";
192
193-- ----------------------------
194-- Records of carts
195-- ----------------------------
196BEGIN;
197INSERT INTO "carts" VALUES ('35', '4', '1', '1', '2', '2', '2017-04-05 07:06:39.164075', '2017-04-05 07:06:39.164091');
198INSERT INTO "carts" VALUES ('36', '21', '1', '1', '2', '9', '2017-04-06 06:29:44.898988', '2017-04-06 06:29:44.899012');
199COMMIT;
200
201-- ----------------------------
202-- Table structure for categories
203-- ----------------------------
204DROP TABLE IF EXISTS "categories";
205CREATE TABLE "categories" (
206 "id" int4 NOT NULL DEFAULT nextval('categories_id_seq'::regclass),
207 "name" varchar(255) COLLATE "default",
208 "description" text COLLATE "default",
209 "status" bool NOT NULL DEFAULT false,
210 "inserted_at" timestamp(6) NOT NULL,
211 "updated_at" timestamp(6) NOT NULL
212)
213WITH (OIDS=FALSE);
214ALTER TABLE "categories" OWNER TO "postgres";
215
216-- ----------------------------
217-- Records of categories
218-- ----------------------------
219BEGIN;
220INSERT INTO "categories" VALUES ('5', 'Hello', 'good', 't', '2017-04-01 15:54:11.432782', '2017-04-01 15:54:11.432794');
221INSERT INTO "categories" VALUES ('8', 'Pixx', 'khmer', 'f', '2017-04-02 15:05:59.486206', '2017-04-02 15:05:59.486221');
222INSERT INTO "categories" VALUES ('4', 'Book khmer', 'hello', 'f', '2017-04-01 15:53:59.086816', '2017-04-03 01:29:52.005699');
223INSERT INTO "categories" VALUES ('7', 'Nokia', 'khmer', 't', '2017-04-02 14:32:51.020503', '2017-04-03 06:20:12.764749');
224INSERT INTO "categories" VALUES ('6', 'Samsung', 'korea', 't', '2017-04-01 15:54:37.200098', '2017-04-03 06:20:22.357196');
225COMMIT;
226
227-- ----------------------------
228-- Table structure for checkout_detail
229-- ----------------------------
230DROP TABLE IF EXISTS "checkout_detail";
231CREATE TABLE "checkout_detail" (
232 "id" int4 NOT NULL DEFAULT nextval('checkout_detail_id_seq'::regclass),
233 "unit" int4,
234 "price" float8,
235 "checkout_id" int4,
236 "book_id" int4,
237 "inserted_at" timestamp(6) NOT NULL,
238 "updated_at" timestamp(6) NOT NULL
239)
240WITH (OIDS=FALSE);
241ALTER TABLE "checkout_detail" OWNER TO "postgres";
242
243-- ----------------------------
244-- Records of checkout_detail
245-- ----------------------------
246BEGIN;
247INSERT INTO "checkout_detail" VALUES ('1', '2', '32', '1', '3', '2017-04-04 02:03:59.714535', '2017-04-04 02:03:59.714548');
248INSERT INTO "checkout_detail" VALUES ('2', '1', '21', '2', '7', '2017-04-05 03:51:18.94627', '2017-04-05 03:51:18.946308');
249COMMIT;
250
251-- ----------------------------
252-- Table structure for checkouts
253-- ----------------------------
254DROP TABLE IF EXISTS "checkouts";
255CREATE TABLE "checkouts" (
256 "id" int4 NOT NULL DEFAULT nextval('checkouts_id_seq'::regclass),
257 "account_id" int4,
258 "status" int4,
259 "inserted_at" timestamp(6) NOT NULL,
260 "updated_at" timestamp(6) NOT NULL
261)
262WITH (OIDS=FALSE);
263ALTER TABLE "checkouts" OWNER TO "postgres";
264
265-- ----------------------------
266-- Records of checkouts
267-- ----------------------------
268BEGIN;
269INSERT INTO "checkouts" VALUES ('2', '2', '1', '2017-04-05 03:51:18.102568', '2017-04-05 03:51:18.102578');
270COMMIT;
271
272-- ----------------------------
273-- Table structure for schema_migrations
274-- ----------------------------
275DROP TABLE IF EXISTS "schema_migrations";
276CREATE TABLE "schema_migrations" (
277 "version" int8 NOT NULL,
278 "inserted_at" timestamp(6) NULL
279)
280WITH (OIDS=FALSE);
281ALTER TABLE "schema_migrations" OWNER TO "postgres";
282
283-- ----------------------------
284-- Records of schema_migrations
285-- ----------------------------
286BEGIN;
287INSERT INTO "schema_migrations" VALUES ('20170316011043', '2017-04-01 08:55:52.799873');
288INSERT INTO "schema_migrations" VALUES ('20170317002148', '2017-04-01 08:55:52.972182');
289INSERT INTO "schema_migrations" VALUES ('20170317041415', '2017-04-01 08:55:53.095104');
290INSERT INTO "schema_migrations" VALUES ('20170317042013', '2017-04-01 08:55:53.206462');
291INSERT INTO "schema_migrations" VALUES ('20170321073039', '2017-04-01 08:55:53.373731');
292INSERT INTO "schema_migrations" VALUES ('20170321074214', '2017-04-01 08:55:53.541806');
293INSERT INTO "schema_migrations" VALUES ('20170323071959', '2017-04-01 08:55:53.663742');
294INSERT INTO "schema_migrations" VALUES ('20170323083020', '2017-04-01 08:55:53.809065');
295INSERT INTO "schema_migrations" VALUES ('20170401080309', '2017-04-01 08:55:53.954362');
296INSERT INTO "schema_migrations" VALUES ('20170403043228', '2017-04-03 06:51:43.635016');
297INSERT INTO "schema_migrations" VALUES ('20170404042832', '2017-04-04 08:30:46.090945');
298INSERT INTO "schema_migrations" VALUES ('20170404080718', '2017-04-04 08:30:46.290905');
299COMMIT;
300
301-- ----------------------------
302-- Table structure for user_profile
303-- ----------------------------
304DROP TABLE IF EXISTS "user_profile";
305CREATE TABLE "user_profile" (
306 "id" int4 NOT NULL DEFAULT nextval('user_profile_id_seq'::regclass),
307 "firstname" varchar(255) COLLATE "default",
308 "lastname" varchar(255) COLLATE "default",
309 "address" varchar(255) COLLATE "default",
310 "photo" varchar(255) COLLATE "default",
311 "status" bool NOT NULL DEFAULT false,
312 "phone" varchar(255) COLLATE "default",
313 "account_id" int4,
314 "inserted_at" timestamp(6) NOT NULL,
315 "updated_at" timestamp(6) NOT NULL
316)
317WITH (OIDS=FALSE);
318ALTER TABLE "user_profile" OWNER TO "postgres";
319
320-- ----------------------------
321-- Records of user_profile
322-- ----------------------------
323BEGIN;
324INSERT INTO "user_profile" VALUES ('1', 'thanak', 'chan', 'thanak@gmail.com', 'thanak.jpg', 't', '876543', '2', '2017-11-01 00:00:00', '2017-12-02 00:00:00');
325COMMIT;
326
327-- ----------------------------
328-- Table structure for who_we_are
329-- ----------------------------
330DROP TABLE IF EXISTS "who_we_are";
331CREATE TABLE "who_we_are" (
332 "id" int4 NOT NULL DEFAULT nextval('who_we_are_id_seq'::regclass),
333 "our_mission" text COLLATE "default",
334 "our_mission_photo" text COLLATE "default",
335 "what_we_do" text COLLATE "default",
336 "what_we_do_photo" text COLLATE "default",
337 "our_product" text COLLATE "default",
338 "our_product_photo" text COLLATE "default",
339 "inserted_at" timestamp(6) NOT NULL,
340 "updated_at" timestamp(6) NOT NULL
341)
342WITH (OIDS=FALSE);
343ALTER TABLE "who_we_are" OWNER TO "postgres";
344
345
346-- ----------------------------
347-- Alter sequences owned by
348-- ----------------------------
349ALTER SEQUENCE "accounts_id_seq" RESTART 4 OWNED BY "accounts"."id";
350ALTER SEQUENCE "authors_id_seq" RESTART 7 OWNED BY "authors"."id";
351ALTER SEQUENCE "books_id_seq" RESTART 10 OWNED BY "books"."id";
352ALTER SEQUENCE "carts_id_seq" RESTART 37 OWNED BY "carts"."id";
353ALTER SEQUENCE "categories_id_seq" RESTART 9 OWNED BY "categories"."id";
354ALTER SEQUENCE "checkout_detail_id_seq" RESTART 3 OWNED BY "checkout_detail"."id";
355ALTER SEQUENCE "checkouts_id_seq" RESTART 3 OWNED BY "checkouts"."id";
356ALTER SEQUENCE "user_profile_id_seq" RESTART 2 OWNED BY "user_profile"."id";
357ALTER SEQUENCE "who_we_are_id_seq" RESTART 2 OWNED BY "who_we_are"."id";
358-- ----------------------------
359-- Primary key structure for table accounts
360-- ----------------------------
361ALTER TABLE "accounts" ADD PRIMARY KEY ("id") NOT DEFERRABLE INITIALLY IMMEDIATE;
362
363-- ----------------------------
364-- Primary key structure for table authors
365-- ----------------------------
366ALTER TABLE "authors" ADD PRIMARY KEY ("id") NOT DEFERRABLE INITIALLY IMMEDIATE;
367
368-- ----------------------------
369-- Primary key structure for table books
370-- ----------------------------
371ALTER TABLE "books" ADD PRIMARY KEY ("id") NOT DEFERRABLE INITIALLY IMMEDIATE;
372
373-- ----------------------------
374-- Primary key structure for table carts
375-- ----------------------------
376ALTER TABLE "carts" ADD PRIMARY KEY ("id") NOT DEFERRABLE INITIALLY IMMEDIATE;
377
378-- ----------------------------
379-- Primary key structure for table categories
380-- ----------------------------
381ALTER TABLE "categories" ADD PRIMARY KEY ("id") NOT DEFERRABLE INITIALLY IMMEDIATE;
382
383-- ----------------------------
384-- Primary key structure for table checkout_detail
385-- ----------------------------
386ALTER TABLE "checkout_detail" ADD PRIMARY KEY ("id") NOT DEFERRABLE INITIALLY IMMEDIATE;
387
388-- ----------------------------
389-- Primary key structure for table checkouts
390-- ----------------------------
391ALTER TABLE "checkouts" ADD PRIMARY KEY ("id") NOT DEFERRABLE INITIALLY IMMEDIATE;
392
393-- ----------------------------
394-- Primary key structure for table schema_migrations
395-- ----------------------------
396ALTER TABLE "schema_migrations" ADD PRIMARY KEY ("version") NOT DEFERRABLE INITIALLY IMMEDIATE;
397
398-- ----------------------------
399-- Primary key structure for table user_profile
400-- ----------------------------
401ALTER TABLE "user_profile" ADD PRIMARY KEY ("id") NOT DEFERRABLE INITIALLY IMMEDIATE;
402
403-- ----------------------------
404-- Primary key structure for table who_we_are
405-- ----------------------------
406ALTER TABLE "who_we_are" ADD PRIMARY KEY ("id") NOT DEFERRABLE INITIALLY IMMEDIATE;