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

28 lines
1.0 KiB
MySQL
Raw Normal View History

2022-08-16 17:00:26 +00:00
CREATE TABLE IF NOT EXISTS api_kgon_vendors (
2022-08-18 05:36:36 +00:00
id INTEGER NOT NULL,
company_id INTEGER NOT NULL,
vendor_id INTEGER NOT NULL,
max_bet_casino INTEGER NOT NULL,
max_bet_slot INTEGER NOT NULL,
2022-08-17 17:45:00 +00:00
is_enable CHAR(1) NOT NULL,
2022-08-18 05:36:36 +00:00
bet_count INTEGER NOT NULL,
2022-08-16 17:00:26 +00:00
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),
2022-08-17 17:45:00 +00:00
PRIMARY KEY (id)
2022-08-16 17:00:26 +00:00
);
2022-08-17 17:45:00 +00:00
CREATE INDEX idx_api_kgon_vendors_company_id ON api_kgon_vendors (company_id);
CREATE INDEX idx_api_kgon_vendors_vendor_id ON api_kgon_vendors (vendor_id);
CREATE INDEX idx_api_kgon_vendors_key ON api_kgon_vendors (key);
CREATE INDEX idx_api_kgon_vendors_category ON api_kgon_vendors (category);
2022-08-16 17:00:26 +00:00
-- 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();