Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Add triggers to postgresql baseline.
Browse files Browse the repository at this point in the history
Also remove unnecessary data migration script.
  • Loading branch information
carlosmunoz authored and Carlos A. Munoz committed Aug 30, 2015
1 parent 951357b commit a762536
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.

This file was deleted.

Expand Up @@ -713,3 +713,15 @@ CREATE INDEX FK_TransUnitVariant_TransUnit ON TransMemoryUnitVariant (trans_unit
ALTER TABLE TransMemory_Metadata ADD FOREIGN KEY (trans_memory_id) REFERENCES TransMemory (id);
ALTER TABLE WebHook ADD FOREIGN KEY (projectId) REFERENCES HProject (id);
CREATE INDEX FK_WebHook_HProject ON WebHook (projectId);

CREATE FUNCTION add_document_history() RETURNS trigger AS $add_document_history$
BEGIN
IF NEW.revision != OLD.revision THEN
INSERT INTO HDocumentHistory(document_id,revision,contentType,docId,locale,name,path,lastChanged,last_modified_by_id,obsolete)
VALUES (OLD.id,OLD.revision,OLD.contentType,OLD.docId,OLD.locale,OLD.name,OLD.path,OLD.lastChanged,OLD.last_modified_by_id,OLD.obsolete);
END IF;
END;
$add_document_history$ LANGUAGE plpgsql;

CREATE TRIGGER HDocument_Update BEFORE UPDATE ON HDocument
FOR EACH ROW EXECUTE PROCEDURE add_document_history();

0 comments on commit a762536

Please sign in to comment.