OSDN Git Service

implemented textsearch
[tdcgexplorer/nimono.git] / db / development_structure.sql
1 --
2 -- PostgreSQL database dump
3 --
4
5 SET statement_timeout = 0;
6 SET client_encoding = 'UTF8';
7 SET standard_conforming_strings = off;
8 SET check_function_bodies = false;
9 SET client_min_messages = warning;
10 SET escape_string_warning = off;
11
12 SET search_path = public, pg_catalog;
13
14 --
15 -- Name: furigana(text); Type: FUNCTION; Schema: public; Owner: -
16 --
17
18 CREATE FUNCTION furigana(text) RETURNS text
19     LANGUAGE c IMMUTABLE STRICT
20     AS '$libdir/textsearch_ja', 'furigana';
21
22
23 --
24 -- Name: hiragana(text); Type: FUNCTION; Schema: public; Owner: -
25 --
26
27 CREATE FUNCTION hiragana(text) RETURNS text
28     LANGUAGE c IMMUTABLE STRICT
29     AS '$libdir/textsearch_ja', 'hiragana';
30
31
32 --
33 -- Name: ja_analyze(text); Type: FUNCTION; Schema: public; Owner: -
34 --
35
36 CREATE FUNCTION ja_analyze(text, OUT word text, OUT type text, OUT subtype1 text, OUT subtype2 text, OUT subtype3 text, OUT conjtype text, OUT conjugation text, OUT basic text, OUT ruby text, OUT pronounce text) RETURNS SETOF record
37     LANGUAGE c IMMUTABLE STRICT
38     AS '$libdir/textsearch_ja', 'ja_analyze';
39
40
41 --
42 -- Name: ja_normalize(text); Type: FUNCTION; Schema: public; Owner: -
43 --
44
45 CREATE FUNCTION ja_normalize(text) RETURNS text
46     LANGUAGE c IMMUTABLE STRICT
47     AS '$libdir/textsearch_ja', 'ja_normalize';
48
49
50 --
51 -- Name: ja_wakachi(text); Type: FUNCTION; Schema: public; Owner: -
52 --
53
54 CREATE FUNCTION ja_wakachi(text) RETURNS text
55     LANGUAGE c IMMUTABLE STRICT
56     AS '$libdir/textsearch_ja', 'ja_wakachi';
57
58
59 --
60 -- Name: katakana(text); Type: FUNCTION; Schema: public; Owner: -
61 --
62
63 CREATE FUNCTION katakana(text) RETURNS text
64     LANGUAGE c IMMUTABLE STRICT
65     AS '$libdir/textsearch_ja', 'katakana';
66
67
68 --
69 -- Name: ts_ja_end(internal); Type: FUNCTION; Schema: public; Owner: -
70 --
71
72 CREATE FUNCTION ts_ja_end(internal) RETURNS void
73     LANGUAGE c STRICT
74     AS '$libdir/textsearch_ja', 'ts_ja_end';
75
76
77 --
78 -- Name: ts_ja_gettoken(internal, internal, internal); Type: FUNCTION; Schema: public; Owner: -
79 --
80
81 CREATE FUNCTION ts_ja_gettoken(internal, internal, internal) RETURNS internal
82     LANGUAGE c STRICT
83     AS '$libdir/textsearch_ja', 'ts_ja_gettoken';
84
85
86 --
87 -- Name: ts_ja_lexize(internal, internal, internal, internal); Type: FUNCTION; Schema: public; Owner: -
88 --
89
90 CREATE FUNCTION ts_ja_lexize(internal, internal, internal, internal) RETURNS internal
91     LANGUAGE c STRICT
92     AS '$libdir/textsearch_ja', 'ts_ja_lexize';
93
94
95 --
96 -- Name: ts_ja_start(internal, integer); Type: FUNCTION; Schema: public; Owner: -
97 --
98
99 CREATE FUNCTION ts_ja_start(internal, integer) RETURNS internal
100     LANGUAGE c STRICT
101     AS '$libdir/textsearch_ja', 'ts_ja_start';
102
103
104 --
105 -- Name: web_query(text); Type: FUNCTION; Schema: public; Owner: -
106 --
107
108 CREATE FUNCTION web_query(text) RETURNS text
109     LANGUAGE sql IMMUTABLE STRICT
110     AS $_$
111   SELECT regexp_replace(regexp_replace(regexp_replace($1,
112     E'(^|\\s+)-', E'\\1!', 'g'),
113     E'\\s+OR\\s+', '|', 'g'),
114     E'\\s+', '&', 'g');
115 $_$;
116
117
118 SET default_tablespace = '';
119
120 SET default_with_oids = false;
121
122 --
123 -- Name: arcs; Type: TABLE; Schema: public; Owner: -; Tablespace: 
124 --
125
126 CREATE TABLE arcs (
127     id integer NOT NULL,
128     code character varying(10) NOT NULL,
129     extname character varying(10) NOT NULL,
130     location_id integer,
131     summary character varying(255),
132     origname character varying(255),
133     created_at timestamp without time zone,
134     updated_at timestamp without time zone
135 );
136
137
138 --
139 -- Name: arcs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
140 --
141
142 CREATE SEQUENCE arcs_id_seq
143     START WITH 1
144     INCREMENT BY 1
145     NO MAXVALUE
146     NO MINVALUE
147     CACHE 1;
148
149
150 --
151 -- Name: arcs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
152 --
153
154 ALTER SEQUENCE arcs_id_seq OWNED BY arcs.id;
155
156
157 --
158 -- Name: locations; Type: TABLE; Schema: public; Owner: -; Tablespace: 
159 --
160
161 CREATE TABLE locations (
162     id integer NOT NULL,
163     code character varying(10) NOT NULL,
164     site character varying(255) NOT NULL,
165     summary character varying(255) NOT NULL,
166     created_at timestamp without time zone,
167     updated_at timestamp without time zone
168 );
169
170
171 --
172 -- Name: locations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
173 --
174
175 CREATE SEQUENCE locations_id_seq
176     START WITH 1
177     INCREMENT BY 1
178     NO MAXVALUE
179     NO MINVALUE
180     CACHE 1;
181
182
183 --
184 -- Name: locations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
185 --
186
187 ALTER SEQUENCE locations_id_seq OWNED BY locations.id;
188
189
190 --
191 -- Name: pmds; Type: TABLE; Schema: public; Owner: -; Tablespace: 
192 --
193
194 CREATE TABLE pmds (
195     id integer NOT NULL,
196     arc_id integer,
197     path character varying(255) NOT NULL,
198     created_at timestamp without time zone,
199     updated_at timestamp without time zone
200 );
201
202
203 --
204 -- Name: pmds_id_seq; Type: SEQUENCE; Schema: public; Owner: -
205 --
206
207 CREATE SEQUENCE pmds_id_seq
208     START WITH 1
209     INCREMENT BY 1
210     NO MAXVALUE
211     NO MINVALUE
212     CACHE 1;
213
214
215 --
216 -- Name: pmds_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
217 --
218
219 ALTER SEQUENCE pmds_id_seq OWNED BY pmds.id;
220
221
222 --
223 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace: 
224 --
225
226 CREATE TABLE schema_migrations (
227     version character varying(255) NOT NULL
228 );
229
230
231 --
232 -- Name: thumbs; Type: TABLE; Schema: public; Owner: -; Tablespace: 
233 --
234
235 CREATE TABLE thumbs (
236     video_id character varying(15) NOT NULL,
237     title character varying(255),
238     description text,
239     created_at timestamp without time zone,
240     updated_at timestamp without time zone,
241     vector tsvector
242 );
243
244
245 --
246 -- Name: vmds; Type: TABLE; Schema: public; Owner: -; Tablespace: 
247 --
248
249 CREATE TABLE vmds (
250     id integer NOT NULL,
251     arc_id integer,
252     path character varying(255) NOT NULL,
253     created_at timestamp without time zone,
254     updated_at timestamp without time zone
255 );
256
257
258 --
259 -- Name: vmds_id_seq; Type: SEQUENCE; Schema: public; Owner: -
260 --
261
262 CREATE SEQUENCE vmds_id_seq
263     START WITH 1
264     INCREMENT BY 1
265     NO MAXVALUE
266     NO MINVALUE
267     CACHE 1;
268
269
270 --
271 -- Name: vmds_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
272 --
273
274 ALTER SEQUENCE vmds_id_seq OWNED BY vmds.id;
275
276
277 --
278 -- Name: xes; Type: TABLE; Schema: public; Owner: -; Tablespace: 
279 --
280
281 CREATE TABLE xes (
282     id integer NOT NULL,
283     arc_id integer,
284     path character varying(255) NOT NULL,
285     created_at timestamp without time zone,
286     updated_at timestamp without time zone
287 );
288
289
290 --
291 -- Name: xes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
292 --
293
294 CREATE SEQUENCE xes_id_seq
295     START WITH 1
296     INCREMENT BY 1
297     NO MAXVALUE
298     NO MINVALUE
299     CACHE 1;
300
301
302 --
303 -- Name: xes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
304 --
305
306 ALTER SEQUENCE xes_id_seq OWNED BY xes.id;
307
308
309 --
310 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
311 --
312
313 ALTER TABLE arcs ALTER COLUMN id SET DEFAULT nextval('arcs_id_seq'::regclass);
314
315
316 --
317 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
318 --
319
320 ALTER TABLE locations ALTER COLUMN id SET DEFAULT nextval('locations_id_seq'::regclass);
321
322
323 --
324 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
325 --
326
327 ALTER TABLE pmds ALTER COLUMN id SET DEFAULT nextval('pmds_id_seq'::regclass);
328
329
330 --
331 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
332 --
333
334 ALTER TABLE vmds ALTER COLUMN id SET DEFAULT nextval('vmds_id_seq'::regclass);
335
336
337 --
338 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
339 --
340
341 ALTER TABLE xes ALTER COLUMN id SET DEFAULT nextval('xes_id_seq'::regclass);
342
343
344 --
345 -- Name: arcs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
346 --
347
348 ALTER TABLE ONLY arcs
349     ADD CONSTRAINT arcs_pkey PRIMARY KEY (id);
350
351
352 --
353 -- Name: locations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
354 --
355
356 ALTER TABLE ONLY locations
357     ADD CONSTRAINT locations_pkey PRIMARY KEY (id);
358
359
360 --
361 -- Name: pmds_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
362 --
363
364 ALTER TABLE ONLY pmds
365     ADD CONSTRAINT pmds_pkey PRIMARY KEY (id);
366
367
368 --
369 -- Name: vmds_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
370 --
371
372 ALTER TABLE ONLY vmds
373     ADD CONSTRAINT vmds_pkey PRIMARY KEY (id);
374
375
376 --
377 -- Name: xes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
378 --
379
380 ALTER TABLE ONLY xes
381     ADD CONSTRAINT xes_pkey PRIMARY KEY (id);
382
383
384 --
385 -- Name: index_thumbs_on_vector; Type: INDEX; Schema: public; Owner: -; Tablespace: 
386 --
387
388 CREATE INDEX index_thumbs_on_vector ON thumbs USING gin (vector);
389
390
391 --
392 -- Name: index_thumbs_on_video_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
393 --
394
395 CREATE UNIQUE INDEX index_thumbs_on_video_id ON thumbs USING btree (video_id);
396
397
398 --
399 -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace: 
400 --
401
402 CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
403
404
405 --
406 -- Name: tsvectorupdate; Type: TRIGGER; Schema: public; Owner: -
407 --
408
409 CREATE TRIGGER tsvectorupdate
410     BEFORE INSERT OR UPDATE ON thumbs
411     FOR EACH ROW
412     EXECUTE PROCEDURE tsvector_update_trigger('vector', 'pg_catalog.japanese', 'description');
413
414
415 --
416 -- PostgreSQL database dump complete
417 --
418
419 INSERT INTO schema_migrations (version) VALUES ('20100608074721');
420
421 INSERT INTO schema_migrations (version) VALUES ('20100608080758');
422
423 INSERT INTO schema_migrations (version) VALUES ('20100608081439');
424
425 INSERT INTO schema_migrations (version) VALUES ('20100608143904');
426
427 INSERT INTO schema_migrations (version) VALUES ('20100608144944');
428
429 INSERT INTO schema_migrations (version) VALUES ('20100612234341');
430
431 INSERT INTO schema_migrations (version) VALUES ('20100613202235');
432
433 INSERT INTO schema_migrations (version) VALUES ('20100613202356');
434
435 INSERT INTO schema_migrations (version) VALUES ('20100613205243');