-
Notifications
You must be signed in to change notification settings - Fork 3
/
yandexdirectlowcase.sql
274 lines (206 loc) · 6.42 KB
/
yandexdirectlowcase.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
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.4.0
-- Dumped by pg_dump version 9.4.1
-- Started on 2015-04-10 22:56:20 NOVT
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
DROP DATABASE yandexdirect;
--
-- TOC entry 2068 (class 1262 OID 70724)
-- Name: yandexdirect; Type: DATABASE; Schema: -; Owner: yadirect
--
CREATE DATABASE yandexdirect WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'ru_RU.utf8' LC_CTYPE = 'ru_RU.utf8';
ALTER DATABASE yandexdirect OWNER TO yadirect;
\connect yandexdirect
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
--
-- TOC entry 6 (class 2615 OID 2200)
-- Name: public; Type: SCHEMA; Schema: -; Owner: postgres
--
CREATE SCHEMA public;
ALTER SCHEMA public OWNER TO postgres;
--
-- TOC entry 2069 (class 0 OID 0)
-- Dependencies: 6
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
--
COMMENT ON SCHEMA public IS 'standard public schema';
--
-- TOC entry 177 (class 3079 OID 11897)
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- TOC entry 2071 (class 0 OID 0)
-- Dependencies: 177
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- TOC entry 174 (class 1259 OID 70797)
-- Name: banners; Type: TABLE; Schema: public; Owner: yadirect; Tablespace:
--
CREATE TABLE banners (
adgroupid integer,
bannerid integer NOT NULL,
statusarchive boolean,
statusactivating character varying(40),
title character varying(255),
text character varying(1024),
campaignid integer NOT NULL,
isactive boolean,
startdate date DEFAULT now()
);
ALTER TABLE banners OWNER TO yadirect;
--
-- TOC entry 173 (class 1259 OID 70769)
-- Name: campaigns; Type: TABLE; Schema: public; Owner: yadirect; Tablespace:
--
CREATE TABLE campaigns (
login character varying(120) NOT NULL,
managername character varying(120),
strategyname character varying(60),
startdate date,
daybudgetenabled boolean,
contextstrategyname character varying(60),
sum money,
agencyname character varying(120),
sumavailablefortransfer money,
name character varying(255),
clicks integer,
statusshow boolean,
campaigncurrency character varying(120),
statusmoderate character varying(40),
statusactivating character varying(40),
shows integer,
rest integer,
campaignid integer NOT NULL,
isactive boolean,
statusarchive boolean,
status character varying(250)
);
ALTER TABLE campaigns OWNER TO yadirect;
--
-- TOC entry 172 (class 1259 OID 70743)
-- Name: clients; Type: TABLE; Schema: public; Owner: yadirect; Tablespace:
--
CREATE TABLE clients (
sendaccnews boolean DEFAULT false,
login character varying(120) DEFAULT ''::character varying NOT NULL,
sharedaccountenabled boolean DEFAULT false,
fio character varying(250) DEFAULT ''::character varying,
datecreate date,
displaystorerating boolean,
sendwarn boolean DEFAULT false,
email character varying(120),
vatrate integer,
phone character varying(60),
role character(60),
overdraftsumavailable integer,
statusarch boolean,
clientcurrencies character varying(60),
sendnews boolean,
nonresident boolean,
discount integer
);
ALTER TABLE clients OWNER TO yadirect;
--
-- TOC entry 175 (class 1259 OID 70826)
-- Name: phrases; Type: TABLE; Schema: public; Owner: yadirect; Tablespace:
--
CREATE TABLE phrases (
statusphrasemoderate character varying(40),
autobroker boolean,
isrubric boolean,
contextprice character varying(40),
phraseid integer NOT NULL,
adgroupid integer,
campaignid integer,
price money,
bannerid integer NOT NULL,
phrase character varying(250),
autobudgetpriority character varying(40),
statuspaused boolean
);
ALTER TABLE phrases OWNER TO yadirect;
--
-- TOC entry 176 (class 1259 OID 70872)
-- Name: statistic; Type: TABLE; Schema: public; Owner: yadirect; Tablespace:
--
CREATE TABLE statistic (
campaignid integer NOT NULL,
bannerid integer NOT NULL,
clicks integer,
showscontext integer,
sumcontext real,
sumsearch real,
clickscontext integer,
shows integer,
clickssearch integer,
sum real,
showssearch integer,
statdate date NOT NULL
);
ALTER TABLE statistic OWNER TO yadirect;
--
-- TOC entry 1950 (class 2606 OID 70804)
-- Name: Banners_pkey; Type: CONSTRAINT; Schema: public; Owner: yadirect; Tablespace:
--
ALTER TABLE ONLY banners
ADD CONSTRAINT "Banners_pkey" PRIMARY KEY (campaignid, bannerid);
--
-- TOC entry 1948 (class 2606 OID 70777)
-- Name: Campaigns_pkey; Type: CONSTRAINT; Schema: public; Owner: yadirect; Tablespace:
--
ALTER TABLE ONLY campaigns
ADD CONSTRAINT "Campaigns_pkey" PRIMARY KEY (login, campaignid);
--
-- TOC entry 1945 (class 2606 OID 70764)
-- Name: Clients_pkey; Type: CONSTRAINT; Schema: public; Owner: yadirect; Tablespace:
--
ALTER TABLE ONLY clients
ADD CONSTRAINT "Clients_pkey" PRIMARY KEY (login);
--
-- TOC entry 1952 (class 2606 OID 70837)
-- Name: Phrases_pkey; Type: CONSTRAINT; Schema: public; Owner: yadirect; Tablespace:
--
ALTER TABLE ONLY phrases
ADD CONSTRAINT "Phrases_pkey" PRIMARY KEY (bannerid, phraseid);
--
-- TOC entry 1954 (class 2606 OID 70876)
-- Name: Statistic_pkey; Type: CONSTRAINT; Schema: public; Owner: yadirect; Tablespace:
--
ALTER TABLE ONLY statistic
ADD CONSTRAINT "Statistic_pkey" PRIMARY KEY (campaignid, bannerid, statdate);
--
-- TOC entry 1946 (class 1259 OID 70772)
-- Name: Campaigns_Login_idx; Type: INDEX; Schema: public; Owner: yadirect; Tablespace:
--
CREATE INDEX "Campaigns_Login_idx" ON campaigns USING btree (login);
--
-- TOC entry 2070 (class 0 OID 0)
-- Dependencies: 6
-- 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;
-- Completed on 2015-04-10 22:56:36 NOVT
--
-- PostgreSQL database dump complete
--