26 lines
1.1 KiB
SQL
26 lines
1.1 KiB
SQL
CREATE TABLE IF NOT EXISTS member_game_settings (
|
|
id UUID DEFAULT uuid_generate_v4(),
|
|
member_id UUID NOT NULL,
|
|
can_bet_casino BOOLEAN NOT NULL DEFAULT TRUE,
|
|
can_bet_slot BOOLEAN NOT NULL DEFAULT TRUE,
|
|
can_bet_powerball BOOLEAN NOT NULL DEFAULT TRUE,
|
|
can_bet_powerladder BOOLEAN NOT NULL DEFAULT TRUE,
|
|
can_bet_eos BOOLEAN NOT NULL DEFAULT TRUE,
|
|
can_bet_bogglepowerball BOOLEAN NOT NULL DEFAULT TRUE,
|
|
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_member_game_settings_member_id
|
|
FOREIGN KEY(member_id)
|
|
REFERENCES members(id)
|
|
);
|
|
|
|
CREATE INDEX idx_member_game_settings_member_id ON member_game_settings (member_id);
|
|
|
|
-- trigger (updated_at)
|
|
CREATE TRIGGER tg_member_game_settings_updated_at
|
|
BEFORE UPDATE
|
|
ON member_game_settings
|
|
FOR EACH ROW
|
|
EXECUTE PROCEDURE update_updated_at_column();
|