map table and ts update trigger

This commit is contained in:
zuk 2017-02-26 12:34:17 +01:00
parent 1b67136579
commit eecf436aaa

View file

@ -14,3 +14,22 @@ role_list user_role[] not null default ARRAY['USER'::user_role],
user_data jsonb
);
create table maps(
id bigserial primary key,
name text not null,
description text,
owner integer not null references users(id),
createts timestamptz not null default now(),
updatets timestamptz not null default now(),
map_data jsonb
);
create or replace function update_ts_tg() returns trigger as $$
begin
new.updatets:=now();
return new;
end;
$$
language plpgsql;
create trigger tg_update_ts before update on users for each row execute procedure update_ts_tg();
create trigger tg_update_ts before update on maps for each row execute procedure update_ts_tg();