Add database internal edit_* tables CUID, CSS loading style
all edit_* have CUID random alphanumeric unique id with 12 characters length. automatically created on INSERT and not touched on update. but can be udpated manually on UPDATE command. on INSERT cuid is ALWAYS overwritten with auto create Add CSS loading style sheet
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
-- adds the created or updated date tags
|
||||
|
||||
CREATE OR REPLACE FUNCTION set_generic() RETURNS TRIGGER AS '
|
||||
DECLARE
|
||||
random_length INT = 12; -- that should be long enough
|
||||
BEGIN
|
||||
IF TG_OP = ''INSERT'' THEN
|
||||
NEW.date_created := ''now'';
|
||||
NEW.cuid := random_string(random_length);
|
||||
ELSIF TG_OP = ''UPDATE'' THEN
|
||||
NEW.date_updated := ''now'';
|
||||
END IF;
|
||||
|
||||
Reference in New Issue
Block a user