map table and ts update trigger
This commit is contained in:
parent
1b67136579
commit
eecf436aaa
1 changed files with 19 additions and 0 deletions
|
@ -14,3 +14,22 @@ role_list user_role[] not null default ARRAY['USER'::user_role],
|
||||||
user_data jsonb
|
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();
|
||||||
|
|
Loading…
Reference in a new issue