drop table  foltia_program ;

create table foltia_program (
tid int8 PRIMARY KEY, 
title text ,
startweektype text,
starttime text,
lengthmin int8,
firstlight text,
officialuri text , 
aspect int8 , 
psp int8 , 
transfer text,
PSPdirname text 
);
create unique index foltia_program_tid_index on foltia_program (tid);

REVOKE ALL on "foltia_program" from PUBLIC;
GRANT UPDATE,SELECT,INSERT on "foltia_program" to "foltia";

drop table  foltia_subtitle ;

create table foltia_subtitle (
pid int8  PRIMARY KEY,
tid int8, 
stationid int8,
countno int8,
subtitle text,
startdatetime int8,
enddatetime int8,
startoffset int8,
lengthmin int8,
m2pfilename text ,
PSPfilename text 
);
create unique index foltia_subtitle_pid_index on foltia_subtitle (pid);
create  index foltia_subtitle_tid_index on foltia_subtitle (tid);
create  index foltia_subtitle_stationid_index on foltia_subtitle (stationid);
create  index foltia_subtitle_enddatetime_index on foltia_subtitle (enddatetime);
create  index foltia_subtitle_startdatetime_index on foltia_subtitle (startdatetime);

REVOKE ALL on "foltia_subtitle" from PUBLIC;
GRANT UPDATE,SELECT,INSERT on "foltia_subtitle" to "foltia";

drop table foltia_tvrecord;
create table foltia_tvrecord (
tid int8,
stationid int8,
bitrate int8
);
create  index foltia_tvrecord_tid_index on foltia_tvrecord (tid);

REVOKE ALL on "foltia_tvrecord" from PUBLIC;
GRANT ALL on "foltia_tvrecord" to "foltia";


drop table foltia_epg;
create table foltia_epg (
epgid int8,
startdatetime int8,
enddatetime int8,
lengthmin int8 ,
ontvchannel text,
epgtitle text,
epgdesc text,
epgcategory text 
);
create  index foltia_epg_startdatetime_index on foltia_epg (startdatetime);
create  index foltia_epg_enddatetime_index on foltia_epg (enddatetime);
create  index foltia_epg_ontvchannel_index on foltia_epg (ontvchannel);

REVOKE ALL on "foltia_epg" from PUBLIC;
GRANT ALL on "foltia_epg" to "foltia";

drop table foltia_m2pfiles;
create table foltia_m2pfiles (
m2pfilename text 
);
REVOKE ALL on "foltia_m2pfiles" from PUBLIC;
GRANT ALL on "foltia_m2pfiles" to "foltia";

drop table foltia_mp4files;
create table foltia_mp4files (
tid int8,
mp4filename text 
);
REVOKE ALL on "foltia_mp4files" from PUBLIC;
GRANT ALL on "foltia_mp4files" to "foltia";

drop table foltia_station;
CREATE TABLE foltia_station (
    stationid bigint NOT NULL,
    stationname text,
    stationrecch bigint,
    stationcallsign text,
    stationuri text,
    tunertype text,
    tunerch text,
    device text,
    ontvcode text
);
REVOKE ALL on "foltia_station" from PUBLIC;
GRANT ALL on "foltia_station" to "foltia";

--
-- PostgreSQL database dump
--

SET client_encoding = 'EUC_JP';
SET check_function_bodies = false;

SET SESSION AUTHORIZATION 'foltia';

SET search_path = public, pg_catalog;

--
-- TOC entry 3 (OID 17158)
-- Name: foltia_station; Type: TABLE; Schema: public; Owner: foltia
--

--
-- TOC entry 4 (OID 17158)
-- Name: foltia_station; Type: ACL; Schema: public; Owner: foltia
--


SET SESSION AUTHORIZATION 'foltia';

--
-- Data for TOC entry 6 (OID 17158)
-- Name: foltia_station; Type: TABLE DATA; Schema: public; Owner: foltia
--
INSERT INTO foltia_program VALUES (0, 'EPGϿ', '', '', NULL, '', '', 3, 1, '', '');
INSERT INTO foltia_tvrecord VALUES (0,0,5);

INSERT INTO foltia_station VALUES (1, 'NHK', 1, 'NHK', '', NULL, NULL, NULL, '0031.ontvjapan.com');
INSERT INTO foltia_station VALUES (3, 'NHK', 3, 'ETV', '', NULL, NULL, NULL, '0041.ontvjapan.com');
INSERT INTO foltia_station VALUES (4, 'ܥƥ', 4, 'NTV', '', NULL, NULL, NULL, '0004.ontvjapan.com');
INSERT INTO foltia_station VALUES (6, 'TBS', 6, 'TBS', '', NULL, NULL, NULL, '0005.ontvjapan.com');
INSERT INTO foltia_station VALUES (8, 'եƥ', 8, 'CX', '', NULL, NULL, NULL, '0006.ontvjapan.com');
INSERT INTO foltia_station VALUES (10, 'ƥī', 10, 'EX', '', NULL, NULL, NULL, '0007.ontvjapan.com');
INSERT INTO foltia_station VALUES (12, 'ƥ', 12, 'TX', '', NULL, NULL, NULL, '0008.ontvjapan.com');
INSERT INTO foltia_station VALUES (422, '쳤ƥ', -10, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (42, 'tvk', 5, 'TVK', '', NULL, NULL, NULL, '0009.ontvjapan.com');
INSERT INTO foltia_station VALUES (423, 'ShowTime', -10, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (424, 'ƥ', -10, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (409, 'BSƥ', 0, '', '', 'b', 'X141', NULL, '3004.ontvjapan.com');
INSERT INTO foltia_station VALUES (384, 'BSī', 0, '', '', 'b', 'X151', NULL, '3005.ontvjapan.com');
INSERT INTO foltia_station VALUES (425, 'ťƥ', -10, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (426, 'ƥ', -10, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (293, 'AT-X', 0, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (161, 'BS-i', 0, '', '', 'b', 'X161', NULL, '3006.ontvjapan.com');
INSERT INTO foltia_station VALUES (382, 'BSѥ', 0, '', '', 'b', 'X171', NULL, '3007.ontvjapan.com');
INSERT INTO foltia_station VALUES (295, 'ե721', -10, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (380, 'ѡ180ch', -10, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (427, '', -10, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (428, 'ƥӿ', -10, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (383, 'ƥ', -10, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (429, 'CBCƥ', -10, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (385, 'TBSͥ', 0, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (386, 'ƥīͥ', 0, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (389, 'BS Japan', 0, '', '', 'b', 'X171', NULL, NULL);
INSERT INTO foltia_station VALUES (390, 'ƥӥ', -10, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (0, '[]', 0, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (392, 'ѡ183ch', 0, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (393, 'BSQR 489', -10, '', '', 'b', 'X489', NULL, NULL);
INSERT INTO foltia_station VALUES (394, 'ѡ160ch', -10, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (396, 'KBS', -10, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (398, 'ƥ', -10, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (399, 'ABCƥ', -10, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (400, 'ʤ', -10, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (402, 'ƥ', -10, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (406, 'MBS', -10, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (407, 'animate.tv', -10, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (410, 'ƥӰ', -10, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (411, '󥿡ͥå', -10, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (381, 'BSե', 0, '', '', 'b', 'X181', NULL, '3008.ontvjapan.com');
INSERT INTO foltia_station VALUES (413, 'ߤƥ', -10, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (414, 'LFX488', -10, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (415, 'LFX', -10, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (416, 'LFX BB', -10, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (191, 'WOWOW', 0, 'BS5', '', 'b', 'X191', NULL, '3009.ontvjapan.com');
INSERT INTO foltia_station VALUES (419, 'GyaO', -10, '', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (418, '', 0, 'UAIR', '', NULL, NULL, NULL, '0013.ontvjapan.com');
INSERT INTO foltia_station VALUES (420, 'WOWOW2', 0, NULL, NULL, 'b', 'X192', NULL, '3010.ontvjapan.com');
INSERT INTO foltia_station VALUES (417, 'Ȥƥ', -10, 'TTV', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (412, 'ϥƥ', -10, 'GTV', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (46, 'եƥ', -10, 'CTC', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (38, 'ƥӺ', -10, 'TVS', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (14, 'MXƥ', 0, 'MX', '', NULL, NULL, NULL, NULL);
INSERT INTO foltia_station VALUES (421, 'WOWOW3', 0, NULL, NULL, 'b', 'X193', NULL, '3011.ontvjapan.com');
INSERT INTO foltia_station VALUES (401, 'ͥNECO', 0, '', '', 'c', 'X242', NULL, '1008.ontvjapan.com');
INSERT INTO foltia_station VALUES (395, 'ߥ󥰥TV', 0, '', '', 'c', 'X245', NULL, '1012.ontvjapan.com');
INSERT INTO foltia_station VALUES (408, 'եߥ꡼', 0, '', '', 'c', 'X254', NULL, '1015.ontvjapan.com');
INSERT INTO foltia_station VALUES (397, 'ȥͥåȥ', 0, '', '', 'c', 'X262', NULL, '1046.ontvjapan.com');
INSERT INTO foltia_station VALUES (103, 'NHK-BShi', 0, '', '', 'b', 'X103', '', '3003.ontvjapan.com');
INSERT INTO foltia_station VALUES (101, 'NHK-BS1', 0, 'BS7', '', 'b', 'X101',NULL,  '3001.ontvjapan.com');
INSERT INTO foltia_station VALUES (102, 'NHK-BS2', 0, 'BS11', '',  'b', 'X102',NULL,  '3002.ontvjapan.com');
INSERT INTO foltia_station VALUES (261, 'åơ', 0, '', '', 'c', 'X264', '', '1045.ontvjapan.com');
INSERT INTO foltia_station VALUES (263, '˥ޥå', 0, '', '', 'c', 'X263', '', '1047.ontvjapan.com');




--
-- TOC entry 5 (OID 17163)
-- Name: foltia_station_pkey; Type: CONSTRAINT; Schema: public; Owner: foltia
--

ALTER TABLE ONLY foltia_station
    ADD CONSTRAINT foltia_station_pkey PRIMARY KEY (stationid);



