Sha256: 379fbaa397adcbe1e49939fc32533d44c75d51de1bdd86352b3ec70d9b72d430
Contents?: true
Size: 497 Bytes
Versions: 4
Compression:
Stored size: 497 Bytes
Contents
CREATE OR REPLACE FUNCTION "%{table}_delete" () RETURNS TRIGGER AS $$ BEGIN IF OLD.obsoleted_dt <> 'infinity' THEN RAISE EXCEPTION 'can not delete old row version'; END IF; UPDATE "%{table}" SET "obsoleted_dt" = 'now()' WHERE id = OLD.id; RETURN NULL; -- the row is not actually deleted END; $$ LANGUAGE plpgsql; DROP TRIGGER IF EXISTS %{table}_delete ON %{table}; CREATE TRIGGER "%{table}_delete" BEFORE DELETE ON "%{table}" FOR EACH ROW EXECUTE PROCEDURE "%{table}_delete"();
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
mcfly-0.0.4 | lib/mcfly/delete_trig.sql |
mcfly-0.0.3 | lib/mcfly/delete_trig.sql |
mcfly-0.0.2 | lib/mcfly/delete_trig.sql |
mcfly-0.0.1 | lib/mcfly/delete_trig.sql |