15 lines
507 B
SQL
15 lines
507 B
SQL
CREATE TABLE IF NOT EXISTS api_kgon_balances (
|
|
id SERIAL PRIMARY KEY,
|
|
balance BIGINT NOT NULL DEFAULT 0,
|
|
balance_bota BIGINT NOT NULL DEFAULT 0,
|
|
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
|
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000)
|
|
);
|
|
|
|
-- trigger (updated_at)
|
|
CREATE TRIGGER tg_api_kgon_balances_updated_at
|
|
BEFORE UPDATE
|
|
ON api_kgon_balances
|
|
FOR EACH ROW
|
|
EXECUTE PROCEDURE update_updated_at_column();
|