beteran-api-kgon-server-ser.../migrations/202208061200_api_kgon_vendor/up.sql

26 lines
863 B
MySQL
Raw Normal View History

2022-08-16 17:00:26 +00:00
CREATE TABLE IF NOT EXISTS api_kgon_vendors (
id BIGINT NOT NULL,
company_id BIGINT NOT NULL,
vendor_id BIGINT NOT NULL,
max_bet_casino BIGINT NOT NULL,
max_bet_slot BIGINT NOT NULL,
is_enable BOOLEAN NOT NULL,
bet_count BIGINT NOT NULL,
key TEXT NOT NULL,
name TEXT NOT NULL,
category TEXT NOT NULL,
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
PRIMARY KEY (id),
CONSTRAINT fk_api_kgon_vendors_parent_id
FOREIGN KEY(parent_id)
REFERENCES roles(id)
);
-- trigger (updated_at)
CREATE TRIGGER tg_api_kgon_vendors_updated_at
BEFORE UPDATE
ON api_kgon_vendors
FOR EACH ROW
EXECUTE PROCEDURE update_updated_at_column();