Add edit access automatic UID set psql function

Trigger that gets called when edit access table is insert or update
called.

UID is set by removing all white spaces.
Original name set is already checked for Alphanumeric with spaces and
unique check.

On Insert always set UID.
On Update only set if UID is not set yet.
This commit is contained in:
Clemens Schwaighofer
2016-07-15 11:37:45 +09:00
parent 3aaa9b3f0d
commit 115e9ad700
2 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
-- DROP TRIGGER trg_set_edit_access_uid ON edit_access;
CREATE TRIGGER trg_set_edit_access_uid
BEFORE INSERT OR UPDATE ON edit_access
FOR EACH ROW EXECUTE PROCEDURE set_edit_access_uid();