Skip to content

Commit

Permalink
add post-DEV_6 SQL from PR ome#1645
Browse files Browse the repository at this point in the history
  • Loading branch information
mtbc committed Oct 28, 2013
1 parent 8f8fc76 commit 36f37f4
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions sql/psql/OMERO5.0DEV__6/OMERO4.4__0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
--

---
--- OMERO5 development release upgrade from OMERO4.4__0 to OMERO5.0DEV__6
--- hopefully close to an eventual upgrade from OMERO4.4__0 to OMERO5.0BETA__0.
--- OMERO5 development release upgrade from OMERO4.4__0 to OMERO5.0DEV__6.
---

BEGIN;
Expand Down Expand Up @@ -525,6 +524,24 @@ CREATE TRIGGER _fs_log_delete
AFTER DELETE ON originalfile
FOR EACH ROW EXECUTE PROCEDURE _fs_log_delete();

--
-- Upgrade beyond OMERO5.0DEV__6. Break out into separate script once patch is bumped.
--

-- Prevent Directory entries in the originalfile table from having their mimetype changed.
CREATE FUNCTION _fs_directory_mimetype() RETURNS "trigger" AS $$
BEGIN
IF OLD.mimetype = 'Directory' AND NEW.mimetype != 'Directory' THEN
RAISE EXCEPTION '%%', 'Directory('||OLD.id||')='||OLD.path||OLD.name||'/ must remain a Directory';
END IF;
RETURN NEW;
END;
$$ LANGUAGE plpgsql;

CREATE TRIGGER _fs_directory_mimetype
BEFORE UPDATE ON originalfile
FOR EACH ROW EXECUTE PROCEDURE _fs_directory_mimetype();

--
-- FINISHED
--
Expand Down

0 comments on commit 36f37f4

Please sign in to comment.