--
-- PostgreSQL database dump
--

SET client_encoding = 'UTF8';
SET check_function_bodies = false;
SET client_min_messages = warning;

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;


--
-- Data for Name: versionmatch; Type: TABLE DATA; Schema: public; Owner: postgres
--

DELETE FROM versionmatch WHERE read_only = 0;

UPDATE versionmatch SET client_version='2.5Bc' WHERE read_only = 1;


--
-- Data for Name: serverinf; Type: TABLE DATA; Schema: public; Owner: postgres
--

UPDATE serverinf SET "version"='2.5Bc';


--
-- Data for Name: clientprofile; Type: TABLE DATA; Schema: public; Owner: postgres
--

ALTER TABLE clientprofile ADD COLUMN schedule_status integer DEFAULT 0;


--
-- Name: gw_relay_list; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE gw_relay_list (
    caller_socket_available boolean,
    caller_socket bigint,
    caller_private_ipv4_address character varying(20),
    caller_private_portno integer,
    caller_public_ipv4_address character varying(20),
    caller_public_portno integer,
    "200_arrived" boolean,
    callee_socket_available boolean,
    callee_socket bigint,
    callee_private_ipv4_address character varying(20),
    callee_private_portno integer,
    callee_public_ipv4_address character varying(20),
    callee_public_portno integer,
    session_name character varying(20),
    caller_transaction_ptr bigint,
    callee_transaction_ptr bigint,
    relay_listkey integer NOT NULL
);


ALTER TABLE public.gw_relay_list OWNER TO postgres;

--
-- Name: gw_relay_list_relay_listkey_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE gw_relay_list_relay_listkey_seq
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.gw_relay_list_relay_listkey_seq OWNER TO postgres;

--
-- Name: gw_relay_list_relay_listkey_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE gw_relay_list_relay_listkey_seq OWNED BY gw_relay_list.relay_listkey;


--
-- Name: gw_relay_list_relay_listkey_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('gw_relay_list_relay_listkey_seq', 1, true);


--
-- Name: relay_listkey; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE gw_relay_list ALTER COLUMN relay_listkey SET DEFAULT nextval('gw_relay_list_relay_listkey_seq'::regclass);


--
-- Name: gw_relay_list_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY gw_relay_list
    ADD CONSTRAINT gw_relay_list_pkey PRIMARY KEY (relay_listkey);


--
-- Data for Name: logoption; Type: TABLE DATA; Schema: public; Owner: postgres
--

ALTER TABLE logoption ADD COLUMN changed boolean DEFAULT false;


--
-- Name: record_changed_flag(); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION record_changed_flag() RETURNS trigger
    AS $$
BEGIN
	IF OLD.changed = true AND NEW.changed = false THEN
		-- ...
	ELSE
		IF OLD.category != NEW.category OR
			OLD.report != NEW.report OR
			OLD.save != NEW.save THEN
			NEW.changed = true;
		END IF;
	END IF;
	
	RETURN NEW;
END;$$
    LANGUAGE plpgsql;


ALTER FUNCTION public.record_changed_flag() OWNER TO postgres;


--
-- Name: record_changed_flag; Type: TRIGGER; Schema: public; Owner: postgres
--

CREATE TRIGGER record_changed_flag
    BEFORE UPDATE ON logoption
    FOR EACH ROW
    EXECUTE PROCEDURE record_changed_flag();
    

--
-- Data for Name: ucuser_profile; Type: TABLE DATA; Schema: public; Owner: postgres
--

ALTER TABLE ucuser_profile ADD COLUMN client_key_string character varying(50);
ALTER TABLE ucuser_profile ADD COLUMN registered_addr_pointer bigint;
ALTER TABLE ucuser_profile ADD COLUMN destination_addr_pointer bigint;
ALTER TABLE ucuser_profile ADD COLUMN register_table_page bigint;
ALTER TABLE ucuser_profile ADD COLUMN registered_time bigint;


--
-- Data for Name: private_memberlist; Type: TABLE DATA; Schema: public; Owner: postgres
--

ALTER TABLE private_memberlist ADD COLUMN blocked_by_peer boolean DEFAULT false;
ALTER TABLE private_memberlist ADD COLUMN allowed_remote_monitoring boolean DEFAULT false;


--
-- Data for Name: serverinf; Type: TABLE DATA; Schema: public; Owner: postgres
--

ALTER TABLE serverinf ADD COLUMN weblink_view_type integer DEFAULT 1;


--
-- Name: init_private_memberlist_redundant_column(); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION init_private_memberlist_redundant_column() RETURNS void
    AS $$
BEGIN
	UPDATE private_memberlist pm1
	   SET blocked_by_peer=true
	  FROM private_memberlist pm2
	 WHERE pm2.blocked = true AND pm2.owner_key = pm1.member_key AND pm2.member_key = pm1.owner_key;

	UPDATE private_memberlist pm1
	   SET allowed_remote_monitoring=true
	  FROM private_memberlist pm2
	 WHERE pm2.remote_monitoring_allow = true AND pm2.owner_key = pm1.member_key AND pm2.member_key = pm1.owner_key;
END;$$
    LANGUAGE plpgsql;


ALTER FUNCTION public.init_private_memberlist_redundant_column() OWNER TO postgres;


SELECT * FROM init_private_memberlist_redundant_column();


--
-- Name: apply_private_memberlist_redundant_column(); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION apply_private_memberlist_redundant_column() RETURNS trigger
    AS $$
DECLARE
     sinf_r private_memberlist%ROWTYPE;
BEGIN
	IF (TG_OP = 'UPDATE') THEN
		IF (OLD.blocked = true AND NEW.blocked = false) OR 
		   (OLD.blocked = false AND NEW.blocked = true) THEN
			UPDATE private_memberlist
			   SET blocked_by_peer=NEW.blocked
			 WHERE owner_key = NEW.member_key AND member_key = NEW.owner_key;
		END IF;
		
		IF (OLD.remote_monitoring_allow = true AND NEW.remote_monitoring_allow = false) OR 
		   (OLD.remote_monitoring_allow = false AND NEW.remote_monitoring_allow = true) THEN
			UPDATE private_memberlist
			   SET allowed_remote_monitoring=NEW.remote_monitoring_allow
			 WHERE owner_key = NEW.member_key AND member_key = NEW.owner_key;
		END IF;
	END IF;
	
	IF (TG_OP = 'INSERT') THEN
		UPDATE private_memberlist
		   SET blocked_by_peer=NEW.blocked
		 WHERE owner_key = NEW.member_key AND member_key = NEW.owner_key;

		SELECT * INTO sinf_r 
		  FROM private_memberlist 
		 WHERE owner_key = NEW.member_key AND member_key = NEW.owner_key;
		IF FOUND THEN
			NEW.blocked_by_peer = sinf_r.blocked;
		END IF;

		UPDATE private_memberlist
		   SET allowed_remote_monitoring=NEW.remote_monitoring_allow
		 WHERE owner_key = NEW.member_key AND member_key = NEW.owner_key;

		SELECT * INTO sinf_r 
		  FROM private_memberlist 
		 WHERE owner_key = NEW.member_key AND member_key = NEW.owner_key;
		IF FOUND THEN
			NEW.allowed_remote_monitoring = sinf_r.remote_monitoring_allow;
		END IF;
	END IF;
	
	RETURN NEW;
END;$$
    LANGUAGE plpgsql;


ALTER FUNCTION public.apply_private_memberlist_redundant_column() OWNER TO postgres;


--
-- Name: apply_private_memberlist_redundant_column; Type: TRIGGER; Schema: public; Owner: postgres
--

CREATE TRIGGER apply_private_memberlist_redundant_column
    BEFORE INSERT OR UPDATE ON private_memberlist
    FOR EACH ROW
    EXECUTE PROCEDURE apply_private_memberlist_redundant_column();


--
-- Name: admin_message_link_user_index; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX admin_message_link_user_index ON admin_message_link USING btree (client_key);


--
-- Name: imr_scenario_user_index; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX imr_scenario_user_index ON imr_scenario USING btree (client_key);


--
-- Name: imr_usergroup_scenario_index; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX imr_usergroup_scenario_index ON imr_usergroup USING btree (scenario_key);


--
-- Name: loghistory_dateinf_index; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX loghistory_dateinf_index ON loghistory USING btree (dateinf);


--
-- Name: login_history_dateinf_index; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX login_history_dateinf_index ON login_history USING btree (dateinf);


--
-- Name: private_group_user_index; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX private_group_user_index ON private_group USING btree (client_key);


--
-- Name: recent_history_user_index; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX recent_history_user_index ON recent_history USING btree (client_key);


--
-- Name: remain_note_owner_index; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX remain_note_owner_index ON remain_note USING btree (own_key);


--
-- Name: schedule_datalist_creator_index; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX schedule_datalist_creator_index ON schedule_datalist USING btree (creator_key);


--
-- Name: schedule_datalist_folder_index; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX schedule_datalist_folder_index ON schedule_datalist USING btree (folder_key);


--
-- Name: schedule_datalist_startdate_index; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX schedule_datalist_startdate_index ON schedule_datalist USING btree (start_dateinf);


--
-- Name: schedule_datalist_enddate_index; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX schedule_datalist_enddate_index ON schedule_datalist USING btree (end_dateinf);


--
-- Name: get_rmon_allow(boolean, integer, boolean, boolean); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION get_rmon_allow(blocked_by_peer boolean, im_status integer, monitoring_use boolean, monitoring_allow boolean) RETURNS integer
    AS $_$DECLARE
	blocked_by_peer ALIAS FOR $1;
	im_status ALIAS FOR $2;
	monitoring_use ALIAS FOR $3;
	monitoring_allow ALIAS FOR $4;
BEGIN
	IF blocked_by_peer THEN
	  return 0;
	END IF;
	
	IF im_status = 0 OR im_status IS NULL THEN
	  return 0;
	END IF;
	
	IF monitoring_use AND monitoring_allow THEN
		return 1;
	ELSE
		return 0;
	END IF;
END;$_$
    LANGUAGE plpgsql;


ALTER FUNCTION public.get_rmon_allow(blocked_by_peer boolean, im_status integer, monitoring_use boolean, monitoring_allow boolean) OWNER TO postgres;


--
-- Name: get_schedule_list(integer); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE OR REPLACE FUNCTION get_schedule_list("user" integer)
  RETURNS SETOF schedule_list AS
$BODY$DECLARE

    user ALIAS FOR $1;
    r RECORD;
    sinf_r schedule_list%ROWTYPE;
    
BEGIN
    FOR r IN 
	SELECT 	schedule_list.*, schedule_manager.manager_key
	FROM 	schedule_list
	LEFT JOIN schedule_manager 
	ON (schedule_list.serial_key = schedule_manager.folder_key AND schedule_manager.manager_key = user)
	WHERE schedule_list.public_flag = 1 OR (schedule_list.public_flag = 0 and schedule_list.creator_key = user)
	ORDER BY public_flag
    LOOP

	sinf_r.serial_key  			= r.serial_key;
  	sinf_r.folder_name 			= r.folder_name;
  	sinf_r.public_flag 			= r.public_flag;
  	sinf_r.creator_key 			= r.creator_key;
  	sinf_r.open_all_schedule 	= r.open_all_schedule;

	IF r.public_flag THEN
		IF r.manager_key = user THEN
			sinf_r.access_right	= 1;
		ELSE
			sinf_r.access_right	= 0;
		END IF;
	ELSE
		sinf_r.access_right	= 1;
	END IF;

    RETURN NEXT sinf_r; 

    END LOOP; 

    RETURN; 

END;$BODY$
  LANGUAGE 'plpgsql' VOLATILE
  COST 100
  ROWS 1000;
ALTER FUNCTION get_schedule_list(integer) OWNER TO postgres;


--
-- Name: get_schedule_data(character varying, character varying, integer); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE OR REPLACE FUNCTION get_schedule_data(start_day character varying, end_day character varying, creator integer) RETURNS SETOF schedule_data
    AS $_$DECLARE
	start_day ALIAS FOR $1;
	end_day ALIAS FOR $2;
	creator ALIAS FOR $3;
	r RECORD;
	f RECORD;
	sinf_r schedule_data%ROWTYPE;
	sinf_f schedule_folderlist%ROWTYPE;
BEGIN
FOR f IN 
	SELECT 	* 
	FROM 	schedule_folderlist
	WHERE 	public_flag = true or (public_flag = false and creator_key = creator)
	LOOP
		FOR r IN 
			SELECT * 
			  FROM schedule_data
			 WHERE folder_key = f.serial_key AND (end_dateinf::date >= start_day::date and end_day::date >= start_dateinf::date)
		LOOP
			sinf_r = r;
			RETURN NEXT sinf_r; 
		END LOOP; 
	END LOOP; 
	
	RETURN; 
END;$_$
    LANGUAGE plpgsql;


ALTER FUNCTION public.get_schedule_data(start_day character varying, end_day character varying, creator integer) OWNER TO postgres;


--
-- Name: get_schedule_open(character varying, character varying, integer); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE OR REPLACE FUNCTION get_schedule_open(start_day character varying, end_day character varying, creator integer) RETURNS SETOF schedule_open
    AS $_$DECLARE
	start_day ALIAS FOR $1;
	end_day ALIAS FOR $2;
	creator ALIAS FOR $3;
	r RECORD;
	sinf_r schedule_open%ROWTYPE;
BEGIN
	FOR r IN 
		SELECT * 
		  FROM schedule_open
		 WHERE (end_dateinf::date >= start_day::date and end_day::date >= start_dateinf::date) AND (creator_key = creator)
		 ORDER BY start_dateinf
		LOOP
			sinf_r = r;
			RETURN NEXT sinf_r; 
    END LOOP; 
	RETURN; 
END;$_$
    LANGUAGE plpgsql;


ALTER FUNCTION public.get_schedule_open(start_day character varying, end_day character varying, creator integer) OWNER TO postgres;


--
-- Name: schedule_status; Type: VIEW; Schema: public; Owner: postgres
--

CREATE VIEW schedule_status AS 
 SELECT cp.client_key, COALESCE(sc.schedule_count::bigint, 0::bigint)::integer AS schedule_status
   FROM clientprofile cp
   LEFT JOIN ( SELECT sd.creator_key, (count(sd.creator_key) > 0)::integer AS schedule_count
           FROM schedule_datalist sd, schedule_folderlist sf
          WHERE (sd.open_to_others = true OR sf.open_all_schedule = true) AND sf.serial_key = sd.folder_key AND sf.public_flag = false AND sd.end_dateinf::text >= 'now'::text::date::text AND 'now'::text::date::text >= sd.start_dateinf::text
          GROUP BY sd.creator_key) sc ON cp.client_key = sc.creator_key;

ALTER TABLE schedule_status OWNER TO postgres;


--
-- Name: alluserstatus; Type: VIEW; Schema: public; Owner: postgres
--

DROP VIEW alluserstatus;

CREATE VIEW alluserstatus AS 
 SELECT pl.owner_key, pl.member_key, pl.group_id, pl.group_name::character varying(64) AS group_name, ui.user_id, ui.first_name, ui.nickname, ui.desktop_phone1, ui.desktop_phone2, ui.desktop_phone3, ui.cellular_phone, ui.email_address1, ui.home_telephone, ui.home_address::character varying(255) AS home_address, ui.office_name, ui.office_department, ui.office_telephone, ui.office_fax, ui.office_address::character varying(255) AS office_address, ui.pbx_system_key, ui.picture_index, pl.blocked::integer AS blocked, ui.registered::integer AS registered, get_im_status(pl.blocked, ui.registered, pl.blocked_by_peer, pl.im_status) AS im_status, pl.phone_status, get_video_status(pl.blocked_by_peer, pl.video_status) AS video_status, get_today_user_message(pl.blocked_by_peer, pl.today_user_message)::character varying(100) AS today_user_message, COALESCE(pl.blocked_by_peer, false)::integer AS blocked_by_peer, translate(ui.desktop_phone1::text, '()-+ '::text, ''::text)::character varying(64) AS desktop_phone1_dgt, translate(ui.desktop_phone2::text, '()-+ '::text, ''::text)::character varying(64) AS desktop_phone2_dgt, translate(ui.desktop_phone3::text, '()-+ '::text, ''::text)::character varying(64) AS desktop_phone3_dgt, translate(ui.office_telephone::text, '()-+ '::text, ''::text)::character varying(64) AS office_telephone_dgt, translate(ui.cellular_phone::text, '()-+ '::text, ''::text)::character varying(64) AS cellular_phone_dgt, translate(ui.home_telephone::text, '()-+ '::text, ''::text)::character varying(64) AS home_telephone_dgt, COALESCE(pl.schedule_status, 0) AS schedule_status, pl.timezone_region, pl.timezone_offset, pl.timezone_daylightsaving_use::integer AS timezone_daylightsaving_use, get_rmon_allow(pl.blocked_by_peer, pl.im_status, pl.remote_monitoring_use, pl.allowed_remote_monitoring) AS monitoring_allow
   FROM ( SELECT psg.owner_key, psg.member_key, psg.blocked, psg.group_id, psg.remote_monitoring_allow, psg.blocked_by_peer, psg.allowed_remote_monitoring, psg.im_status, psg.video_status, psg.group_name, cp.phone_status, cp.today_user_message, cp.schedule_status, cp.timezone_region, cp.timezone_offset, cp.timezone_daylightsaving_use, cp.remote_monitoring_use
           FROM ( SELECT ps.owner_key, ps.member_key, ps.blocked, ps.group_id, ps.remote_monitoring_allow, ps.blocked_by_peer, ps.allowed_remote_monitoring, ps.im_status, ps.video_status, pg.group_name
                   FROM ( SELECT pm.owner_key, pm.member_key, pm.blocked, pm.group_id, pm.remote_monitoring_allow, pm.blocked_by_peer, pm.allowed_remote_monitoring, up.im_status, up.video_status
                           FROM private_memberlist pm
                      LEFT JOIN ucuser_profile up ON pm.member_key = up.client_key) ps
              LEFT JOIN private_group pg ON pg.group_key = ps.group_id) psg
      LEFT JOIN clientprofile cp ON psg.member_key = cp.client_key) pl, userinf ui
  WHERE pl.member_key = ui.user_key;

ALTER TABLE alluserstatus OWNER TO postgres;


--
-- Name: allclientstatus; Type: VIEW; Schema: public; Owner: postgres
--

DROP VIEW allclientstatus;

CREATE VIEW allclientstatus AS
    SELECT pm.user_key, pm.user_id, pm.first_name, pm.nickname, pm.desktop_phone1, pm.desktop_phone2, pm.desktop_phone3, 
    	   pm.cellular_phone, pm.email_address1, pm.home_telephone, (pm.home_address)::character varying(255) AS home_address, 
    	   pm.office_name, pm.office_department, pm.office_telephone, pm.office_fax, 
    	   (pm.office_address)::character varying(255) AS office_address, pm.pbx_system_key, pm.picture_index, 
    	   (pm.registered)::integer AS registered, get_im_status(pm.registered, us.im_status) AS im_status, us.phone_status, 
    	   us.video_status, us.timezone_region, us.timezone_offset, 
    	   (us.timezone_daylightsaving_use)::integer AS timezone_daylightsaving_use, us.schedule_status, us.today_user_message, 
    	   (translate((pm.desktop_phone1)::text, '()-+ '::text, ''::text))::character varying(64) AS desktop_phone1_dgt, 
    	   (translate((pm.desktop_phone2)::text, '()-+ '::text, ''::text))::character varying(64) AS desktop_phone2_dgt, 
    	   (translate((pm.desktop_phone3)::text, '()-+ '::text, ''::text))::character varying(64) AS desktop_phone3_dgt, 
    	   (translate((pm.office_telephone)::text, '()-+ '::text, ''::text))::character varying(64) AS office_telephone_dgt, 
    	   (translate((pm.cellular_phone)::text, '()-+ '::text, ''::text))::character varying(64) AS cellular_phone_dgt, 
    	   (translate((pm.home_telephone)::text, '()-+ '::text, ''::text))::character varying(64) AS home_telephone_dgt 
      FROM (SELECT ui.user_key, ui.user_id, ui.first_name, ui.nickname, ui.desktop_phone1, ui.desktop_phone2, ui.desktop_phone3, 
      			   ui.cellular_phone, ui.email_address1, ui.home_telephone, ui.home_address, ui.office_name, ui.office_department, 
      			   ui.office_telephone, ui.office_fax, ui.office_address, ui.picture_index, ui.registered, ui.pbx_system_key 
      		  FROM userinf ui) pm, 
      	   (SELECT cp.client_key, cp.phone_status, cp.timezone_region, cp.timezone_offset, cp.timezone_daylightsaving_use, 
      	   		   cp.today_user_message, cp.schedule_status, up.im_status, up.video_status 
      	   	  FROM (clientprofile cp LEFT JOIN ucuser_profile up ON ((cp.client_key = up.client_key)))) us 
     WHERE (us.client_key = pm.user_key);


ALTER TABLE public.allclientstatus OWNER TO postgres;


--
-- Name: gw_register_list; Type: VIEW; Schema: public; Owner: postgres
--

CREATE OR REPLACE VIEW gw_register_list AS 
 SELECT up.client_key, up.client_key_string, ui.user_id, ui.first_name, up.public_ipv4_address, up.public_portno, up.private_ipv4_address, up.private_portno, up.using_nat, up.using_relay, up.registered_addr_pointer, up.destination_addr_pointer, up.register_table_page, up.registered_time
   FROM userinf ui, ucuser_profile up
  WHERE ui.user_key = up.client_key;

ALTER TABLE gw_register_list OWNER TO postgres;


--
-- Data for Name: protocol; Type: TABLE DATA; Schema: public; Owner: postgres
--

UPDATE protocol
   SET lvalue=35, dvalue=35
 WHERE property_key='208';


--
-- Name: client_restriction; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE client_restriction (
    client_key integer NOT NULL,
    presence_entry_count integer DEFAULT 100 NOT NULL,
    presence_video_status boolean DEFAULT true,
    presence_schedule_status boolean DEFAULT true,
    presence_remote_monitoring_status boolean DEFAULT true,
    private_contact_entry_count integer DEFAULT 1000 NOT NULL,
    allow_icr boolean DEFAULT true,
    icr_scenario_entry_count integer DEFAULT 10 NOT NULL,
    allow_remote_call_forward boolean DEFAULT true,
    allow_group_call boolean DEFAULT true,
    allow_meetme_conference_call boolean DEFAULT true,
    allow_scheduled_dial boolean DEFAULT true,
    allow_record_call boolean DEFAULT true,
    allow_flexible_button boolean DEFAULT true,
    allow_voice_mail_selection boolean DEFAULT true,
    allow_step_call boolean DEFAULT true,
    allow_playback_wave_file boolean DEFAULT true,
    allow_send_sms boolean DEFAULT true,
    allow_call_memo boolean DEFAULT true,
    allow_call_pickup boolean DEFAULT false,
    allow_meetme_chattingroom boolean DEFAULT true,
    allow_application_sharing boolean DEFAULT true,
    allow_desktop_sharing boolean DEFAULT true,
    allow_whiteboard boolean DEFAULT true,
    allow_file_send boolean DEFAULT true,
    file_send_maximum_size integer DEFAULT 200 NOT NULL,
    schedule_appointment_entry_count integer DEFAULT 1000 NOT NULL,
    allow_normal_video boolean DEFAULT true,
    allow_video_format_qcif boolean DEFAULT true,
    allow_video_format_cif boolean DEFAULT true,
    allow_video_format_vga boolean DEFAULT true,
    allow_presentation_mode boolean DEFAULT true,
    allow_remote_monitoring boolean DEFAULT true,
    restricted_feature_invisible boolean DEFAULT true
);


ALTER TABLE public.client_restriction OWNER TO postgres;

--
-- Name: client_restriction_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY client_restriction
    ADD CONSTRAINT client_restriction_pkey PRIMARY KEY (client_key);


--
-- Name: client_restriction_templates; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE client_restriction_templates (
    template_key integer NOT NULL,
    template_description character varying(50),
    presence_entry_count integer DEFAULT 100 NOT NULL,
    presence_video_status boolean DEFAULT true,
    presence_schedule_status boolean DEFAULT true,
    presence_remote_monitoring_status boolean DEFAULT true,
    private_contact_entry_count integer DEFAULT 1000 NOT NULL,
    allow_icr boolean DEFAULT true,
    icr_scenario_entry_count integer DEFAULT 10 NOT NULL,
    allow_remote_call_forward boolean DEFAULT true,
    allow_group_call boolean DEFAULT true,
    allow_meetme_conference_call boolean DEFAULT true,
    allow_scheduled_dial boolean DEFAULT true,
    allow_record_call boolean DEFAULT true,
    allow_flexible_button boolean DEFAULT true,
    allow_voice_mail_selection boolean DEFAULT true,
    allow_step_call boolean DEFAULT true,
    allow_playback_wave_file boolean DEFAULT true,
    allow_send_sms boolean DEFAULT true,
    allow_call_memo boolean DEFAULT true,
    allow_call_pickup boolean DEFAULT false,
    allow_meetme_chattingroom boolean DEFAULT true,
    allow_application_sharing boolean DEFAULT true,
    allow_desktop_sharing boolean DEFAULT true,
    allow_whiteboard boolean DEFAULT true,
    allow_file_send boolean DEFAULT true,
    file_send_maximum_size integer DEFAULT 200 NOT NULL,
    schedule_appointment_entry_count integer DEFAULT 1000 NOT NULL,
    allow_normal_video boolean DEFAULT true,
    allow_video_format_qcif boolean DEFAULT true,
    allow_video_format_cif boolean DEFAULT true,
    allow_video_format_vga boolean DEFAULT true,
    allow_presentation_mode boolean DEFAULT true,
    allow_remote_monitoring boolean DEFAULT true,
    restricted_feature_invisible boolean DEFAULT true
);


ALTER TABLE public.client_restriction_templates OWNER TO postgres;

--
-- Name: client_restriction_templates_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY client_restriction_templates
    ADD CONSTRAINT client_restriction_templates_pkey PRIMARY KEY (template_key);


--
-- Name: multiweblink; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE multiweblink (
    background_color character varying(50),
    background_image_url character varying(255),
    title_text character varying(50),
    title_font character varying(50),
    title_font_size integer DEFAULT 15,
    title_font_italic boolean DEFAULT false,
    title_font_bold boolean DEFAULT false,
    title_image_url character varying(255),
    title_align character varying(10),
    link_image_url character varying(255),
    link_align character varying(10),
    link_arrage character varying(10),
    link_key integer NOT NULL,
    link_font character varying(50),
    link_font_size integer DEFAULT 10,
    bottom_text character varying(255),
    bottom_font character varying(50),
    bottom_font_size integer DEFAULT 9,
    bottom_image_url character varying(255),
    bottom_align character varying(10),
    bottom_font_italic boolean DEFAULT false,
    bottom_font_bold boolean DEFAULT false,
    link_image_width integer DEFAULT 100,
    link_image_height integer DEFAULT 30,
    title_font_color character varying(50),
    bottom_font_color character varying(50),
    link_body text,
    link_body_visible boolean DEFAULT false,
    link_body_align character varying(10),
    link_body_location character varying(10),
    link_body_font character varying(50),
    hr_top_visible boolean DEFAULT true,
    hr_bottom_visible boolean DEFAULT true,
    link_banner_with_text boolean DEFAULT false
);


ALTER TABLE public.multiweblink OWNER TO postgres;

--
-- Name: multiweblink_link_key_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE multiweblink_link_key_seq
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.multiweblink_link_key_seq OWNER TO postgres;

--
-- Name: multiweblink_link_key_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE multiweblink_link_key_seq OWNED BY multiweblink.link_key;


--
-- Name: link_key; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE multiweblink ALTER COLUMN link_key SET DEFAULT nextval('multiweblink_link_key_seq'::regclass);


--
-- Name: multiweblink_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY multiweblink
    ADD CONSTRAINT multiweblink_pkey PRIMARY KEY (link_key);


--
-- Data for Name: multiweblink; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY multiweblink (background_color, background_image_url, title_text, title_font, title_font_size, title_font_italic, title_font_bold, title_image_url, title_align, link_image_url, link_align, link_arrage, link_key, link_font, link_font_size, bottom_text, bottom_font, bottom_font_size, bottom_image_url, bottom_align, bottom_font_italic, bottom_font_bold, link_image_width, link_image_height, title_font_color, bottom_font_color, link_body, link_body_visible, link_body_align, link_body_location, link_body_font, hr_top_visible, hr_bottom_visible, link_banner_with_text) FROM stdin;
aliceblue	\N		Tahoma	10	f	f		left		left	Horizontal	1	Tahoma	10		Tahoma	10		left	f	f	300	100	black	black		f	left	Top	Tahoma	f	f	f
\.


--
-- Name: multiweblink_list; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE multiweblink_list (
    list_key integer NOT NULL,
    list_title character varying(255),
    list_url character varying(255),
    list_url_image_type boolean DEFAULT false,
    list_url_image_url character varying(255)
);


ALTER TABLE public.multiweblink_list OWNER TO postgres;

--
-- Name: multiweblink_list_list_key_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE multiweblink_list_list_key_seq
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.multiweblink_list_list_key_seq OWNER TO postgres;

--
-- Name: multiweblink_list_list_key_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE multiweblink_list_list_key_seq OWNED BY multiweblink_list.list_key;


--
-- Name: list_key; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE multiweblink_list ALTER COLUMN list_key SET DEFAULT nextval('multiweblink_list_list_key_seq'::regclass);


--
-- Name: multiweblink_list_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY multiweblink_list
    ADD CONSTRAINT multiweblink_list_pkey PRIMARY KEY (list_key);


--
-- Name: multiweblink_parameter; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE multiweblink_parameter (
    param_key integer NOT NULL,
    list_key integer NOT NULL,
    param_name character varying(255) NOT NULL,
    param_value integer DEFAULT 0 NOT NULL,
    param_column_name character varying(50)
);


ALTER TABLE public.multiweblink_parameter OWNER TO postgres;

--
-- Name: multiweblink_parameter_param_key_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE multiweblink_parameter_param_key_seq
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.multiweblink_parameter_param_key_seq OWNER TO postgres;

--
-- Name: multiweblink_parameter_param_key_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE multiweblink_parameter_param_key_seq OWNED BY multiweblink_parameter.param_key;


--
-- Name: param_key; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE multiweblink_parameter ALTER COLUMN param_key SET DEFAULT nextval('multiweblink_parameter_param_key_seq'::regclass);


--
-- Name: multiweblink_parameter_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY multiweblink_parameter
    ADD CONSTRAINT multiweblink_parameter_pkey PRIMARY KEY (param_key);


--
-- Data for Name: client_restriction_templates; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY client_restriction_templates (template_key, template_description, presence_entry_count, presence_video_status, presence_schedule_status, presence_remote_monitoring_status, private_contact_entry_count, allow_icr, icr_scenario_entry_count, allow_remote_call_forward, allow_group_call, allow_meetme_conference_call, allow_scheduled_dial, allow_record_call, allow_flexible_button, allow_voice_mail_selection, allow_step_call, allow_playback_wave_file, allow_send_sms, allow_call_memo, allow_call_pickup, allow_meetme_chattingroom, allow_application_sharing, allow_desktop_sharing, allow_whiteboard, allow_file_send, file_send_maximum_size, schedule_appointment_entry_count, allow_normal_video, allow_video_format_qcif, allow_video_format_cif, allow_video_format_vga, allow_presentation_mode, allow_remote_monitoring, restricted_feature_invisible) FROM stdin;
1	Level 1 (Higest)	200	t	t	t	2000	t	10	t	t	t	t	t	t	t	t	t	t	t	f	t	t	t	t	t	200	1000	t	t	t	t	t	t	t
2	Level 2	150	t	t	t	1500	t	10	t	t	t	t	t	t	t	t	t	t	t	f	t	t	t	t	t	150	500	t	t	t	f	t	t	t
3	Level 3	100	t	t	t	1000	t	5	t	t	t	t	t	f	t	f	t	t	f	f	t	t	t	t	t	100	500	t	t	f	f	t	t	t
4	Level 4	100	f	f	f	1000	t	5	f	f	f	f	f	f	f	f	f	f	f	f	f	t	t	t	t	100	300	f	f	f	f	f	f	t
5	Level 5 (Default)	50	f	f	f	500	t	3	f	f	f	f	f	f	f	f	f	f	f	f	f	f	f	f	f	50	100	f	f	f	f	f	f	t
\.


--
-- Name: make_client_restriction(); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION make_client_restriction() RETURNS integer
    AS $$DECLARE
    u RECORD;
    t  RECORD;
BEGIN
	SELECT * INTO t FROM client_restriction_templates WHERE template_key=5;
	IF FOUND THEN
	    FOR u IN 
		SELECT 	user_key
		FROM 	userinf
		WHERE   user_key <> 1 AND user_id <> ''
	    LOOP
			INSERT INTO client_restriction(
			            client_key, presence_entry_count, presence_video_status, presence_schedule_status, 
			            presence_remote_monitoring_status, private_contact_entry_count, 
			            allow_icr, icr_scenario_entry_count, allow_remote_call_forward, 
			            allow_group_call, allow_meetme_conference_call, allow_scheduled_dial, 
			            allow_record_call, allow_flexible_button, allow_voice_mail_selection, 
			            allow_step_call, allow_playback_wave_file, allow_send_sms, allow_call_memo, 
			            allow_call_pickup, allow_meetme_chattingroom, allow_application_sharing, 
			            allow_desktop_sharing, allow_whiteboard, allow_file_send, file_send_maximum_size, 
			            schedule_appointment_entry_count, allow_normal_video, allow_video_format_qcif, 
			            allow_video_format_cif, allow_video_format_vga, allow_presentation_mode, 
			            allow_remote_monitoring, restricted_feature_invisible)
			    VALUES (u.user_key, t.presence_entry_count, t.presence_video_status, t.presence_schedule_status, 
			            t.presence_remote_monitoring_status, t.private_contact_entry_count, 
			            t.allow_icr, t.icr_scenario_entry_count, t.allow_remote_call_forward, 
			            t.allow_group_call, t.allow_meetme_conference_call, t.allow_scheduled_dial, 
			            t.allow_record_call, t.allow_flexible_button, t.allow_voice_mail_selection, 
			            t.allow_step_call, t.allow_playback_wave_file, t.allow_send_sms, t.allow_call_memo, 
			            t.allow_call_pickup, t.allow_meetme_chattingroom, t.allow_application_sharing, 
			            t.allow_desktop_sharing, t.allow_whiteboard, t.allow_file_send, t.file_send_maximum_size, 
			            t.schedule_appointment_entry_count, t.allow_normal_video, t.allow_video_format_qcif, 
			            t.allow_video_format_cif, t.allow_video_format_vga, t.allow_presentation_mode, 
			            t.allow_remote_monitoring, t.restricted_feature_invisible);
	    END LOOP; 
	END IF;
    RETURN 1; 
END;$$
    LANGUAGE plpgsql;


ALTER FUNCTION public.make_client_restriction() OWNER TO postgres;


SELECT * FROM make_client_restriction();


--
-- Name: current_activity; Type: VIEW; Schema: public; Owner: postgres
--

CREATE VIEW current_activity AS
    SELECT pg_stat_activity.datname, pg_stat_activity.usename, pg_stat_activity.procpid, pg_stat_activity.client_addr, pg_stat_activity.waiting, pg_stat_activity.query_start, pg_stat_activity.current_query FROM pg_stat_activity;


ALTER TABLE public.current_activity OWNER TO postgres;


--
-- Data for Name: adminlevel; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY adminlevel (admin_menu, allowed_admin_level, admin_number) FROM stdin;
User Feature Restriction	1	123
Restriction Template	1	923
Multi Web Link	1	124
\.


--
-- Name: clear_call_connection_history(); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION clear_call_connection_history()
  RETURNS trigger AS
$BODY$BEGIN
	IF (TG_TABLE_NAME = 'systeminf') THEN
		IF ((OLD.local_ipv4_address != NEW.local_ipv4_address) OR 
		    (OLD.firewall_ipv4_address != NEW.firewall_ipv4_address)) THEN
			UPDATE clientprofile
			   SET pbx_local_ipv4_address=NULL, pbx_firewall_ipv4_address=NULL
			  FROM userinf
			 WHERE userinf.pbx_system_key=NEW.system_key AND userinf.user_key = clientprofile.client_key;
		END IF;
	ELSIF (TG_TABLE_NAME = 'localsysteminf') THEN
		IF (TG_OP = 'DELETE') THEN
			UPDATE clientprofile
			   SET pbx_local_ipv4_address=NULL, pbx_firewall_ipv4_address=NULL
			  FROM userinf,localsysteminf
			 WHERE userinf.pbx_system_key=OLD.parent_system_key AND 
			 	   userinf.user_key = clientprofile.client_key AND
			 	   clientprofile.pbx_local_ipv4_address = OLD.local_ipv4_address AND 
			 	   clientprofile.pbx_firewall_ipv4_address = OLD.firewall_ipv4_address;
        ELSIF (TG_OP = 'UPDATE') THEN
			IF ((OLD.local_ipv4_address != NEW.local_ipv4_address) OR 
			    (OLD.firewall_ipv4_address != NEW.firewall_ipv4_address)) THEN
				UPDATE clientprofile
				   SET pbx_local_ipv4_address=NULL, pbx_firewall_ipv4_address=NULL
				  FROM userinf,localsysteminf
				 WHERE userinf.pbx_system_key=OLD.parent_system_key AND 
				 	   userinf.user_key = clientprofile.client_key AND
				 	   clientprofile.pbx_local_ipv4_address = OLD.local_ipv4_address AND 
				 	   clientprofile.pbx_firewall_ipv4_address = OLD.firewall_ipv4_address;
	        END IF;
        END IF;
	END IF;

	RETURN NULL;
END;$BODY$
  LANGUAGE 'plpgsql' VOLATILE
  COST 100;
ALTER FUNCTION clear_call_connection_history() OWNER TO postgres;


--
-- Name: clear_call_connection_history; Type: TRIGGER; Schema: public; Owner: postgres
--

CREATE TRIGGER clear_call_connection_history
    AFTER UPDATE ON systeminf
    FOR EACH ROW
    EXECUTE PROCEDURE clear_call_connection_history();


--
-- Name: clear_call_connection_history; Type: TRIGGER; Schema: public; Owner: postgres
--

CREATE TRIGGER clear_call_connection_history
    AFTER DELETE OR UPDATE ON localsysteminf
    FOR EACH ROW
    EXECUTE PROCEDURE clear_call_connection_history();


--
-- Data for Name: versionmatch; Type: TABLE DATA; Schema: public; Owner: postgres
--

UPDATE limitrestriction SET spec=4500 WHERE property='115';
UPDATE limitrestriction SET spec=4500 WHERE property='117';
UPDATE limitrestriction SET spec=4500 WHERE property='103';
UPDATE limitrestriction SET spec=1000 WHERE property='107';

UPDATE limitrestriction SET limitation=1000 WHERE property='107';


--
-- Release Notes
-- Version : B.6Aa 
-- Updated : 2010/03/02
--


--
-- Data for Name: versionmatch; Type: TABLE DATA; Schema: public; Owner: postgres
--

DELETE FROM versionmatch WHERE read_only = 0;

UPDATE versionmatch SET client_version='B.6Aa' WHERE read_only = 1;


--
-- Data for Name: serverinf; Type: TABLE DATA; Schema: public; Owner: postgres
--

UPDATE serverinf SET "version"='B.6Aa';

ALTER TABLE serverinf ADD COLUMN firewall_ipv4_address character varying(50);
ALTER TABLE serverinf ADD COLUMN firewall_ipv6_address character varying(50);


--
-- Data for Name: ucuser_profile; Type: TABLE DATA; Schema: public; Owner: postgres
--

ALTER TABLE ucuser_profile ADD COLUMN access_through_server_firewall boolean DEFAULT false;


--
-- Data for Name: serverstatus; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY serverstatus (name, ip_address, status, relay_count) FROM stdin;
Web Server	127.0.0.1	0	\N
\.


--
-- Data for Name: versionmatch; Type: TABLE DATA; Schema: public; Owner: postgres
--

UPDATE limitrestriction SET spec=15000 WHERE property='115';
UPDATE limitrestriction SET spec=15000 WHERE property='117';
UPDATE limitrestriction SET spec=15000 WHERE property='103';


--
-- Name: schedule_datalist; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE schedule_datalist ADD COLUMN recurrence_state integer DEFAULT 0;


--
-- Function: get_schedule_data(character varying, character varying, integer)
--

DROP FUNCTION get_schedule_data(character varying, character varying, integer);


--
-- Name: schedule_data; Type: VIEW; Schema: public; Owner: postgres
--

DROP VIEW schedule_data;

CREATE OR REPLACE VIEW schedule_data AS 
 SELECT sch.serial_key, sch.folder_name, sch.folder_key, sch.creator_key, sch.created_dateinf, sch.created_timeinf, sch.start_dateinf, sch.start_timeinf, sch.end_dateinf, sch.end_timeinf, sch.subject, sch.schedule_location, sch.contents, sch.attendees, sch.notify_flag, sch.notify_type, sch.notify_timegap, sch.open_to_others, sch.outlook_id, sch.public_flag, sch.scenario_key, imr.destination_type, imr.destination_id, sch.recurrence_state
   FROM ( SELECT sd.serial_key, sf.folder_name, sd.folder_key, sd.creator_key, sd.created_dateinf, sd.created_timeinf, sd.start_dateinf, sd.start_timeinf, sd.end_dateinf, sd.end_timeinf, sd.subject, sd.schedule_location, sd.contents, sd.attendees, sd.notify_flag::integer AS notify_flag, sd.notify_type, sd.notify_timegap, sd.open_to_others::integer AS open_to_others, sd.outlook_id, sf.public_flag::integer AS public_flag, sd.scenario_key, sd.recurrence_state
           FROM schedule_datalist sd, schedule_folderlist sf
          WHERE sd.folder_key = sf.serial_key) sch
   LEFT JOIN imr_usergroup imr ON sch.scenario_key = imr.scenario_key;

ALTER TABLE schedule_data OWNER TO postgres;


--
-- Function: get_schedule_data(character varying, character varying, integer)
--

CREATE OR REPLACE FUNCTION get_schedule_data(start_day character varying, end_day character varying, creator integer)
  RETURNS SETOF schedule_data AS
$BODY$DECLARE

    start_day ALIAS FOR $1;
    end_day ALIAS FOR $2;
    creator ALIAS FOR $3;
    r RECORD;
    f RECORD;
    sinf_r schedule_data%ROWTYPE;
    sinf_f schedule_folderlist%ROWTYPE;
    
BEGIN

    FOR f IN 
	SELECT 	* 
	FROM 	schedule_folderlist
	WHERE 	public_flag = true or (public_flag = false and creator_key = creator)
    LOOP

	    FOR r IN 
		SELECT 	* 
		FROM 	schedule_data
		WHERE 	folder_key = f.serial_key AND (end_dateinf::date >= start_day::date and end_day::date >= start_dateinf::date)
		LOOP
		
			sinf_r = r;
		        RETURN NEXT sinf_r; 

		END LOOP; 

    END LOOP; 

    RETURN; 

END;$BODY$
  LANGUAGE 'plpgsql' VOLATILE
  COST 100
  ROWS 1000;
ALTER FUNCTION get_schedule_data(character varying, character varying, integer) OWNER TO postgres;


--
-- Release Notes
-- Version : 2.6Ac 
-- Updated : 2010/03/12
--


--
-- Data for Name: versionmatch; Type: TABLE DATA; Schema: public; Owner: postgres
--

DELETE FROM versionmatch WHERE read_only = 0;

UPDATE versionmatch SET client_version='2.6Ac' WHERE read_only = 1;


--
-- Data for Name: serverinf; Type: TABLE DATA; Schema: public; Owner: postgres
--

UPDATE serverinf SET "version"='2.6Ac';


--
-- Data for Name: versionmatch; Type: TABLE DATA; Schema: public; Owner: postgres
--

UPDATE limitrestriction SET spec=15000 WHERE property='115';
UPDATE limitrestriction SET spec=15000 WHERE property='117';
UPDATE limitrestriction SET spec=15000 WHERE property='103';


--
-- Release Notes
-- Version : 2.6Ad 
-- Updated : 2010/03/23
--


--
-- Data for Name: versionmatch; Type: TABLE DATA; Schema: public; Owner: postgres
--

DELETE FROM versionmatch WHERE read_only = 0;

UPDATE versionmatch SET client_version='2.6Ad' WHERE read_only = 1;


--
-- Data for Name: serverinf; Type: TABLE DATA; Schema: public; Owner: postgres
--

UPDATE serverinf SET "version"='2.6Ad';


--
-- Data for Name: protocol; Type: TABLE DATA; Schema: public; Owner: postgres
--

UPDATE protocol
   SET lvalue=0, dvalue=0
 WHERE property_key='302';


--
-- Name: schedule_datalist; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE schedule_datalist ADD COLUMN original_dateinf character varying(20);


--
-- Release Notes
-- Version : 2.6Ae 
-- Updated : 2010/03/30
--


--
-- Data for Name: versionmatch; Type: TABLE DATA; Schema: public; Owner: postgres
--

DELETE FROM versionmatch WHERE read_only = 0;

UPDATE versionmatch SET client_version='2.6Ae' WHERE read_only = 1;


--
-- Data for Name: serverinf; Type: TABLE DATA; Schema: public; Owner: postgres
--

UPDATE serverinf SET "version"='2.6Ae';


--
-- Release Notes
-- Version : 2.6Af 
-- Updated : 2010/04/06
--


--
-- Data for Name: versionmatch; Type: TABLE DATA; Schema: public; Owner: postgres
--

DELETE FROM versionmatch WHERE read_only = 0;

UPDATE versionmatch SET client_version='2.6Af' WHERE read_only = 1;


--
-- Data for Name: serverinf; Type: TABLE DATA; Schema: public; Owner: postgres
--

UPDATE serverinf SET "version"='2.6Af';


--
-- Data for Name: protocol; Type: TABLE DATA; Schema: public; Owner: postgres
--

UPDATE protocol
   SET lvalue=0, dvalue=0
 WHERE property_key='305';


COPY protocol (lvalue, dvalue, property_key, property, min_value, max_value) FROM stdin;
0	0	501	FLAG_IM_SESSION_RELAY	0	1
\.


--
-- Release Notes
-- Version : 2.6Ag 
-- Updated : 2010/07/05
--


--
-- Data for Name: versionmatch; Type: TABLE DATA; Schema: public; Owner: postgres
--

DELETE FROM versionmatch WHERE read_only = 0;

UPDATE versionmatch SET client_version='2.6Ag' WHERE read_only = 1;


--
-- Data for Name: serverinf; Type: TABLE DATA; Schema: public; Owner: postgres
--

UPDATE serverinf SET "version"='2.6Ag';


--
-- PostgreSQL database dump complete
--