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

28 lines
1.1 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:57:23 +00:00
id BIGINT NOT NULL,
company_id BIGINT NOT NULL,
vendor_id BIGINT NOT NULL,
2022-08-30 08:30:06 +00:00
max_bet_casino DOUBLE PRECISION NOT NULL DEFAULT 0.00,
max_bet_slot DOUBLE PRECISION NOT NULL DEFAULT 0.00,
2022-08-17 17:45:00 +00:00
is_enable CHAR(1) NOT NULL,
2022-08-18 05:57:23 +00:00
bet_count BIGINT 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();