-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcc.sql
More file actions
942 lines (634 loc) · 20.3 KB
/
Copy pathcc.sql
File metadata and controls
942 lines (634 loc) · 20.3 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
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.6.6
-- Dumped by pg_dump version 9.6.6
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
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 search_path = public, pg_catalog;
--
-- Name: check_ext_pw(character varying, character varying); Type: FUNCTION; Schema: public; Owner: postgres
--
CREATE FUNCTION check_ext_pw(ext character varying, pw character varying) RETURNS integer
LANGUAGE plpgsql
AS $$
declare
r integer;
begin
select count(*) into r from extensions where ext_n=ext and ext_pw=pw;
return r;
end;
$$;
ALTER FUNCTION public.check_ext_pw(ext character varying, pw character varying) OWNER TO postgres;
--
-- Name: operators_history(); Type: FUNCTION; Schema: public; Owner: postgres
--
CREATE FUNCTION operators_history() RETURNS trigger
LANGUAGE plpgsql
AS $$
begin
-- TG_OP
if (TG_OP = 'INSERT') then -- insert
insert into operator_group_history select new.op_id, now(), null, new.op_group;
insert into operator_ext_history select new.op_id, now(), null, new.op_ext;
return new;
elsif (TG_OP = 'DELETE') then -- delete
insert into operator_group_history select old.op_id, now(), old.op_group, null;
insert into operator_ext_history select old.op_id, now(), old.op_ext, null;
return old;
elsif (TG_OP = 'UPDATE') then
if (new.op_group <> old.op_group) then
insert into operator_group_history select new.op_id, now(), old.op_group, new.op_group;
end if;
if (new.op_ext <> old.op_ext) then
insert into operator_ext_history select new.op_id, now(), old.op_ext, new.op_ext;
end if;
return new;
end if;
return null;
end;
$$;
ALTER FUNCTION public.operators_history() OWNER TO postgres;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: call_log; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE call_log (
cl_id bigint NOT NULL,
cl_rand character(32),
cl_tag integer,
cl_operator integer,
cl_rec_uid character varying,
cl_client_phone character varying,
cl_shop_phone character varying,
cl_shop_name character varying,
cl_ring_time timestamp with time zone,
cl_answer_time timestamp with time zone,
cl_end_time timestamp with time zone,
cl_close_time timestamp with time zone,
cl_note character varying,
cl_operator_name character varying,
cl_order character varying,
cl_uid character varying,
cl_direction character varying,
cl_tagdata character varying,
cl_shop_lkid character varying
);
ALTER TABLE call_log OWNER TO postgres;
--
-- Name: call_log_cl_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE call_log_cl_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE call_log_cl_id_seq OWNER TO postgres;
--
-- Name: call_log_cl_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE call_log_cl_id_seq OWNED BY call_log.cl_id;
--
-- Name: call_status; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE call_status (
cs_id bigint NOT NULL,
cs_op integer,
cs_phone character varying,
cs_order character varying,
cs_note character varying,
cs_tag integer
);
ALTER TABLE call_status OWNER TO postgres;
--
-- Name: call_status_cs_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE call_status_cs_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE call_status_cs_id_seq OWNER TO postgres;
--
-- Name: call_status_cs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE call_status_cs_id_seq OWNED BY call_status.cs_id;
--
-- Name: cdr; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE cdr (
id integer NOT NULL,
calldate timestamp with time zone DEFAULT now() NOT NULL,
clid character varying(80),
src character varying(80),
dst character varying(80),
dcontext character varying(80),
channel character varying(80),
dstchannel character varying(80),
lastapp character varying(80),
lastdata character varying(80),
duration integer DEFAULT 0 NOT NULL,
billsec integer DEFAULT 0 NOT NULL,
disposition character varying(45),
amaflags integer DEFAULT 0 NOT NULL,
accountcode character varying(20),
uniqueid character varying(150),
userfield character varying(255),
recordingfile character varying
);
ALTER TABLE cdr OWNER TO postgres;
--
-- Name: cdr_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE cdr_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE cdr_id_seq OWNER TO postgres;
--
-- Name: cdr_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE cdr_id_seq OWNED BY cdr.id;
--
-- Name: extensions; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE extensions (
ext_n character varying NOT NULL,
ext_pw character varying
);
ALTER TABLE extensions OWNER TO postgres;
--
-- Name: leads; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE leads (
l_id bigint NOT NULL,
l_shop_name character varying,
l_shop_phone character varying,
l_shop_eid character varying,
l_client_phone character varying,
l_note character varying,
l_order character varying,
l_when timestamp with time zone,
l_lock_time timestamp with time zone,
l_lock_by character varying,
l_completed boolean DEFAULT false
);
ALTER TABLE leads OWNER TO postgres;
--
-- Name: leads_l_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE leads_l_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE leads_l_id_seq OWNER TO postgres;
--
-- Name: leads_l_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE leads_l_id_seq OWNED BY leads.l_id;
--
-- Name: levels; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE levels (
l_id integer NOT NULL,
l_name character varying,
l_worktime character varying
);
ALTER TABLE levels OWNER TO postgres;
--
-- Name: levels_l_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE levels_l_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE levels_l_id_seq OWNER TO postgres;
--
-- Name: levels_l_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE levels_l_id_seq OWNED BY levels.l_id;
--
-- Name: operator_ext_history; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE operator_ext_history (
op_id integer,
op_eh_tmstmp timestamp without time zone,
op_eh_old character varying,
op_eh_new character varying
);
ALTER TABLE operator_ext_history OWNER TO postgres;
--
-- Name: operator_group_history; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE operator_group_history (
op_id integer,
op_gh_tmstmp timestamp without time zone,
op_gh_old character varying,
op_gh_new character varying
);
ALTER TABLE operator_group_history OWNER TO postgres;
--
-- Name: operators; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE operators (
op_id integer NOT NULL,
op_name character varying,
op_group character varying,
op_ext character varying,
op_location character varying
);
ALTER TABLE operators OWNER TO postgres;
--
-- Name: operators_op_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE operators_op_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE operators_op_id_seq OWNER TO postgres;
--
-- Name: operators_op_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE operators_op_id_seq OWNED BY operators.op_id;
--
-- Name: scheduled_calls; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE scheduled_calls (
oc_id bigint NOT NULL,
oc_shop_name character varying,
oc_shop_phone character varying,
oc_client_phone character varying,
oc_after_call character varying,
oc_order character varying,
oc_when timestamp with time zone,
oc_taken_by character varying
);
ALTER TABLE scheduled_calls OWNER TO postgres;
--
-- Name: scheduled_calls_oc_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE scheduled_calls_oc_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE scheduled_calls_oc_id_seq OWNER TO postgres;
--
-- Name: scheduled_calls_oc_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE scheduled_calls_oc_id_seq OWNED BY scheduled_calls.oc_id;
--
-- Name: shop_ext; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE shop_ext (
shop_id integer,
shop_ext character varying,
shop_ext_tmstmp timestamp without time zone
);
ALTER TABLE shop_ext OWNER TO postgres;
--
-- Name: shops; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE shops (
shop_id integer NOT NULL,
shop_name character varying,
shop_phone character varying,
shop_manager character varying,
shop_script character varying,
shop_manager2 character varying,
shop_queue2 character varying,
shop_queue3 character varying,
shop_active character varying,
shop_level character varying,
shop_eid character varying
);
ALTER TABLE shops OWNER TO postgres;
--
-- Name: shops_shop_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE shops_shop_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE shops_shop_id_seq OWNER TO postgres;
--
-- Name: shops_shop_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE shops_shop_id_seq OWNED BY shops.shop_id;
--
-- Name: sip_users; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE sip_users (
su_id integer NOT NULL,
su_host character varying,
su_username character varying,
su_secret character varying,
su_myext character varying,
su_phone character varying
);
ALTER TABLE sip_users OWNER TO postgres;
--
-- Name: sip_ext; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW sip_ext AS
SELECT sip_users.su_myext AS myext,
sip_users.su_phone AS phone
FROM sip_users;
ALTER TABLE sip_ext OWNER TO postgres;
--
-- Name: sip_users_su_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE sip_users_su_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE sip_users_su_id_seq OWNER TO postgres;
--
-- Name: sip_users_su_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE sip_users_su_id_seq OWNED BY sip_users.su_id;
--
-- Name: tags; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE tags (
tag_id integer NOT NULL,
tag_name character varying,
tag_hasdata boolean
);
ALTER TABLE tags OWNER TO postgres;
--
-- Name: tags_tag_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE tags_tag_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE tags_tag_id_seq OWNER TO postgres;
--
-- Name: tags_tag_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE tags_tag_id_seq OWNED BY tags.tag_id;
--
-- Name: call_log cl_id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY call_log ALTER COLUMN cl_id SET DEFAULT nextval('call_log_cl_id_seq'::regclass);
--
-- Name: call_status cs_id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY call_status ALTER COLUMN cs_id SET DEFAULT nextval('call_status_cs_id_seq'::regclass);
--
-- Name: cdr id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY cdr ALTER COLUMN id SET DEFAULT nextval('cdr_id_seq'::regclass);
--
-- Name: leads l_id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY leads ALTER COLUMN l_id SET DEFAULT nextval('leads_l_id_seq'::regclass);
--
-- Name: levels l_id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY levels ALTER COLUMN l_id SET DEFAULT nextval('levels_l_id_seq'::regclass);
--
-- Name: operators op_id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY operators ALTER COLUMN op_id SET DEFAULT nextval('operators_op_id_seq'::regclass);
--
-- Name: scheduled_calls oc_id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY scheduled_calls ALTER COLUMN oc_id SET DEFAULT nextval('scheduled_calls_oc_id_seq'::regclass);
--
-- Name: shops shop_id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY shops ALTER COLUMN shop_id SET DEFAULT nextval('shops_shop_id_seq'::regclass);
--
-- Name: sip_users su_id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY sip_users ALTER COLUMN su_id SET DEFAULT nextval('sip_users_su_id_seq'::regclass);
--
-- Name: tags tag_id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY tags ALTER COLUMN tag_id SET DEFAULT nextval('tags_tag_id_seq'::regclass);
--
-- Name: call_log call_log_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY call_log
ADD CONSTRAINT call_log_pkey PRIMARY KEY (cl_id);
--
-- Name: call_status call_status_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY call_status
ADD CONSTRAINT call_status_pkey PRIMARY KEY (cs_id);
--
-- Name: cdr cdr_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY cdr
ADD CONSTRAINT cdr_pkey PRIMARY KEY (id);
--
-- Name: extensions extensions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY extensions
ADD CONSTRAINT extensions_pkey PRIMARY KEY (ext_n);
--
-- Name: levels levels_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY levels
ADD CONSTRAINT levels_pkey PRIMARY KEY (l_id);
--
-- Name: operators operators_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY operators
ADD CONSTRAINT operators_pkey PRIMARY KEY (op_id);
--
-- Name: shops shops_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY shops
ADD CONSTRAINT shops_pkey PRIMARY KEY (shop_id);
--
-- Name: sip_users sip_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY sip_users
ADD CONSTRAINT sip_users_pkey PRIMARY KEY (su_id);
--
-- Name: tags tags_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY tags
ADD CONSTRAINT tags_pkey PRIMARY KEY (tag_id);
--
-- Name: tags tags_tag_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY tags
ADD CONSTRAINT tags_tag_name_key UNIQUE (tag_name);
--
-- Name: billsec; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX billsec ON cdr USING btree (billsec);
--
-- Name: calldate; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX calldate ON cdr USING btree (calldate);
--
-- Name: dst; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX dst ON cdr USING btree (dst);
--
-- Name: operators_op_ext_idx; Type: INDEX; Schema: public; Owner: postgres
--
CREATE UNIQUE INDEX operators_op_ext_idx ON operators USING btree (op_ext);
--
-- Name: shops_shop_name_idx; Type: INDEX; Schema: public; Owner: postgres
--
CREATE UNIQUE INDEX shops_shop_name_idx ON shops USING btree (shop_name);
--
-- Name: src; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX src ON cdr USING btree (src);
--
-- Name: call_log call_log_cl_operator_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY call_log
ADD CONSTRAINT call_log_cl_operator_fkey FOREIGN KEY (cl_operator) REFERENCES operators(op_id);
--
-- Name: call_log call_log_cl_tag_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY call_log
ADD CONSTRAINT call_log_cl_tag_fkey FOREIGN KEY (cl_tag) REFERENCES tags(tag_id);
--
-- Name: call_status call_status_cs_op_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY call_status
ADD CONSTRAINT call_status_cs_op_fkey FOREIGN KEY (cs_op) REFERENCES operators(op_id);
--
-- Name: call_status call_status_cs_tag_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY call_status
ADD CONSTRAINT call_status_cs_tag_fkey FOREIGN KEY (cs_tag) REFERENCES tags(tag_id);
--
-- Name: leads leads_l_lock_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY leads
ADD CONSTRAINT leads_l_lock_by_fkey FOREIGN KEY (l_lock_by) REFERENCES operators(op_ext);
--
-- Name: operator_ext_history operator_ext_history_op_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY operator_ext_history
ADD CONSTRAINT operator_ext_history_op_id_fkey FOREIGN KEY (op_id) REFERENCES operators(op_id);
--
-- Name: operator_group_history operator_group_history_op_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY operator_group_history
ADD CONSTRAINT operator_group_history_op_id_fkey FOREIGN KEY (op_id) REFERENCES operators(op_id);
--
-- Name: check_ext_pw(character varying, character varying); Type: ACL; Schema: public; Owner: postgres
--
GRANT ALL ON FUNCTION check_ext_pw(ext character varying, pw character varying) TO cc_data;
--
-- Name: call_log; Type: ACL; Schema: public; Owner: postgres
--
GRANT SELECT,INSERT,UPDATE ON TABLE call_log TO cc_data;
--
-- Name: call_log_cl_id_seq; Type: ACL; Schema: public; Owner: postgres
--
GRANT SELECT,UPDATE ON SEQUENCE call_log_cl_id_seq TO cc_data;
--
-- Name: cdr; Type: ACL; Schema: public; Owner: postgres
--
GRANT INSERT ON TABLE cdr TO cdr;
GRANT SELECT ON TABLE cdr TO cc_data;
--
-- Name: cdr_id_seq; Type: ACL; Schema: public; Owner: postgres
--
GRANT SELECT,UPDATE ON SEQUENCE cdr_id_seq TO cdr;
--
-- Name: extensions; Type: ACL; Schema: public; Owner: postgres
--
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE extensions TO cc_populate;
GRANT SELECT ON TABLE extensions TO cc_data;
--
-- Name: leads; Type: ACL; Schema: public; Owner: postgres
--
GRANT SELECT,INSERT,UPDATE ON TABLE leads TO cc_data;
--
-- Name: levels; Type: ACL; Schema: public; Owner: postgres
--
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE levels TO cc_populate;
--
-- Name: levels_l_id_seq; Type: ACL; Schema: public; Owner: postgres
--
GRANT SELECT,UPDATE ON SEQUENCE levels_l_id_seq TO cc_populate;
--
-- Name: operator_ext_history; Type: ACL; Schema: public; Owner: postgres
--
GRANT SELECT,INSERT,UPDATE ON TABLE operator_ext_history TO cc_populate;
--
-- Name: operator_group_history; Type: ACL; Schema: public; Owner: postgres
--
GRANT SELECT,INSERT,UPDATE ON TABLE operator_group_history TO cc_populate;
--
-- Name: operators; Type: ACL; Schema: public; Owner: postgres
--
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE operators TO cc_populate;
GRANT SELECT,DELETE ON TABLE operators TO cc_data;
--
-- Name: operators_op_id_seq; Type: ACL; Schema: public; Owner: postgres
--
GRANT SELECT,UPDATE ON SEQUENCE operators_op_id_seq TO cc_populate;
--
-- Name: shops; Type: ACL; Schema: public; Owner: postgres
--
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE shops TO cc_populate;
GRANT SELECT ON TABLE shops TO cc_data;
--
-- Name: shops_shop_id_seq; Type: ACL; Schema: public; Owner: postgres
--
GRANT SELECT,UPDATE ON SEQUENCE shops_shop_id_seq TO cc_populate;
--
-- Name: sip_users; Type: ACL; Schema: public; Owner: postgres
--
GRANT SELECT,INSERT ON TABLE sip_users TO cc_populate;
--
-- Name: sip_ext; Type: ACL; Schema: public; Owner: postgres
--
GRANT SELECT ON TABLE sip_ext TO cc_data;
--
-- Name: sip_users_su_id_seq; Type: ACL; Schema: public; Owner: postgres
--
GRANT SELECT,UPDATE ON SEQUENCE sip_users_su_id_seq TO cc_populate;
--
-- Name: tags; Type: ACL; Schema: public; Owner: postgres
--
GRANT SELECT ON TABLE tags TO cc_data;
--
-- PostgreSQL database dump complete
--