2022-08-16 17:00:26 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS api_kgon_games (
|
2022-08-18 05:57:23 +00:00
|
|
|
id BIGINT NOT NULL,
|
2022-08-29 04:14:38 +00:00
|
|
|
parent_id BIGINT NOT NULL,
|
2022-08-16 17:00:26 +00:00
|
|
|
key TEXT NOT NULL,
|
|
|
|
names TEXT NOT NULL,
|
|
|
|
platform TEXT NOT NULL,
|
|
|
|
category TEXT NOT NULL,
|
|
|
|
game_type TEXT NOT NULL,
|
|
|
|
image TEXT,
|
|
|
|
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),
|
2022-08-29 04:14:38 +00:00
|
|
|
CONSTRAINT fk_api_kgon_games_parent_id
|
|
|
|
FOREIGN KEY(parent_id)
|
2022-08-16 17:00:26 +00:00
|
|
|
REFERENCES api_kgon_vendors(id)
|
|
|
|
);
|
|
|
|
|
2022-08-29 04:14:38 +00:00
|
|
|
CREATE INDEX idx_api_kgon_games_parent_id ON api_kgon_games (parent_id);
|
2022-08-17 17:45:00 +00:00
|
|
|
CREATE INDEX idx_api_kgon_games_key ON api_kgon_games (key);
|
|
|
|
CREATE INDEX idx_api_kgon_games_category ON api_kgon_games (category);
|
|
|
|
CREATE INDEX idx_api_kgon_games_game_type ON api_kgon_games (game_type);
|
|
|
|
|
2022-08-16 17:00:26 +00:00
|
|
|
-- trigger (updated_at)
|
|
|
|
CREATE TRIGGER tg_api_kgon_games_updated_at
|
|
|
|
BEFORE UPDATE
|
|
|
|
ON api_kgon_games
|
|
|
|
FOR EACH ROW
|
|
|
|
EXECUTE PROCEDURE update_updated_at_column();
|