· 6 years ago · Sep 04, 2019, 09:00 AM
1DROP TABLE IF EXISTS contact CASCADE;
2CREATE TABLE contact (
3 id bigserial NOT NULL,
4 contact_type bigint,
5 customer bigint,
6 customer_input text,
7 customer_member text,
8 auction_date date,
9 contact_time timestamp,
10 member bigint,
11 item bigint,
12 item_input text,
13 variety bigint,
14 variety_input text,
15 size bigint,
16 size_input text,
17 variety_note text,
18 country bigint,
19 country_input text,
20 supplier bigint,
21 supplier_input text,
22 memo text,
23 reminder timestamp,
24 status integer,
25 active boolean DEFAULT TRUE,
26 version bigint DEFAULT 1,
27 order_num bigint,
28 created_at timestamp with time zone DEFAULT now(),
29 created_by bigint,
30 modified_at timestamp with time zone,
31 modified_by bigint,
32 deleted_at timestamp with time zone,
33 deleted_by bigint,
34 chart_details bigint[],
35 order_memo text,
36 is_order_finished BOOLEAN DEFAULT FALSE,
37 related_contact bigint[],
38 CONSTRAINT pkey_contact PRIMARY KEY (id)
39);
40
41-- Contact_file
42DROP TABLE IF EXISTS contact_file CASCADE;
43CREATE TABLE contact_file (
44 id bigserial NOT NULL,
45 contact bigint,
46 token text,
47 s3url text,
48 type text,
49 filetype text,
50 name text,
51 size integer,
52 created_at timestamp with time zone default now(),
53 created_by bigint,
54 deleted_at timestamp with time zone,
55 deleted_by bigint,
56 active boolean default true,
57 CONSTRAINT pkey_contact_file PRIMARY KEY (id)
58);
59
60-- Contact_status
61DROP TABLE IF EXISTS contact_status CASCADE;
62CREATE TABLE contact_status (
63 id bigserial NOT NULL,
64 name text,
65 tags text[] DEFAULT '{}',
66 order_num bigint,
67 created_at timestamp with time zone DEFAULT now(),
68 created_by bigint,
69 modified_at timestamp with time zone,
70 modified_by bigint,
71 CONSTRAINT pkey_contact_status PRIMARY KEY (id)
72);
73
74INSERT INTO contact_type(name,order_num) VALUES
75 ('予約注文', 1),
76 ('注文', 2),
77 ('入荷予定', 3),
78 ('入荷連絡', 4),
79 ('クレーム', 5),
80 ('その他', 6)
81;
82
83INSERT INTO contact_status(name,order_num) VALUES
84('入力待ち', 1),
85('処理中', 2),
86('要連絡', 3),
87('処理済み', 4)
88;