CREATE TABLE file_location (
fid integer NOT NULL,
- host_id character varying(100),
+ host_id integer,
path text,
renamed timestamp without time zone,
failed_rename boolean NOT NULL DEFAULT false,
- CONSTRAINT file_location_pk PRIMARY KEY (fid )
+ CONSTRAINT file_location_pk PRIMARY KEY (fid, host_id, path )
);
CREATE TABLE unknown_file (
CREATE RULE file_episode_rel_ignore_duplicate AS ON INSERT TO file_episode_rel WHERE (EXISTS (SELECT 1 FROM file_episode_rel WHERE ((file_episode_rel.fid = new.fid) AND (file_episode_rel.eid = new.eid)))) DO INSTEAD NOTHING;
COMMENT ON RULE file_episode_rel_ignore_duplicate ON file_episode_rel IS 'Entries to this table are duplicated in exports';
-CREATE RULE file_location_ignore_duplicate AS ON INSERT TO file_location WHERE (EXISTS (SELECT 1 FROM file_location WHERE (file_location.fid = new.fid))) DO INSTEAD NOTHING;
+CREATE RULE file_location_ignore_duplicate AS ON INSERT TO file_location WHERE (EXISTS (SELECT 1 FROM file_location WHERE (file_location.fid = new.fid AND file_location.host_id = new.host_id AND file_location.path = new.path))) DO INSTEAD NOTHING;
CREATE RULE file_location_update_rule AS ON UPDATE TO file_location DO NOTIFY rename_data_changed;
CREATE RULE new_file_location_rule AS ON INSERT TO file_location DO NOTIFY rename_data_changed;