beteran-api-kgon-server-ser.../migrations/202208051400_api_kgon_balance/up.sql

15 lines
533 B
MySQL
Raw Normal View History

2022-08-16 17:00:26 +00:00
CREATE TABLE IF NOT EXISTS api_kgon_balances (
2022-08-18 02:48:35 +00:00
id SERIAL PRIMARY KEY,
2022-08-30 08:30:06 +00:00
balance DOUBLE PRECISION NOT NULL DEFAULT 0.00,
balance_bota DOUBLE PRECISION NOT NULL DEFAULT 0.00,
2022-08-16 17:00:26 +00:00
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();