mirror of
https://github.com/grassrootseconomics/cic-custodial.git
synced 2024-11-21 22:06:47 +01:00
parent
144d5018ea
commit
9d95f2e8f8
@ -25,4 +25,4 @@ $$ language plpgsql;
|
|||||||
create trigger insert_gas_quota
|
create trigger insert_gas_quota
|
||||||
after insert on keystore
|
after insert on keystore
|
||||||
for each row
|
for each row
|
||||||
execute procedure insert_gas_quota()
|
execute procedure insert_gas_quota();
|
33
migrations/004_updated_at.sql
Normal file
33
migrations/004_updated_at.sql
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
ALTER TABLE keystore
|
||||||
|
ADD COLUMN updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||||
|
|
||||||
|
ALTER TABLE otx_dispatch
|
||||||
|
ADD COLUMN updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||||
|
|
||||||
|
ALTER TABLE gas_quota
|
||||||
|
ADD COLUMN updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||||
|
|
||||||
|
-- updated_at function
|
||||||
|
create function update_timestamp()
|
||||||
|
returns trigger
|
||||||
|
as $$
|
||||||
|
begin
|
||||||
|
new.updated_at = current_timestamp;
|
||||||
|
return new;
|
||||||
|
end;
|
||||||
|
$$ language plpgsql;
|
||||||
|
|
||||||
|
create trigger update_keystore_timestamp
|
||||||
|
before update on keystore
|
||||||
|
for each row
|
||||||
|
execute procedure update_timestamp();
|
||||||
|
|
||||||
|
create trigger update_otx_dispatch_timestamp
|
||||||
|
before update on otx_dispatch
|
||||||
|
for each row
|
||||||
|
execute procedure update_timestamp();
|
||||||
|
|
||||||
|
create trigger update_gas_quota_timestamp
|
||||||
|
before update on gas_quota
|
||||||
|
for each row
|
||||||
|
execute procedure update_timestamp();
|
Loading…
Reference in New Issue
Block a user