2022-08-16 17:00:26 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS api_kgon_members (
|
2022-08-18 05:57:23 +00:00
|
|
|
id BIGINT NOT NULL,
|
|
|
|
balance BIGINT NOT NULL DEFAULT 0,
|
|
|
|
balance_bota BIGINT NOT NULL DEFAULT 0,
|
|
|
|
balance_sum BIGINT NOT NULL DEFAULT 0,
|
|
|
|
companies BIGINT NOT NULL DEFAULT 0,
|
2022-08-19 03:20:45 +00:00
|
|
|
oriental_play CHAR(1) NOT NULL DEFAULT 'n',
|
2022-08-16 17:00:26 +00:00
|
|
|
member_id UUID 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_members_member_id
|
|
|
|
FOREIGN KEY(member_id)
|
|
|
|
REFERENCES members(id)
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE INDEX idx_api_kgon_members_member_id ON api_kgon_members (member_id);
|
|
|
|
|
|
|
|
-- trigger (updated_at)
|
|
|
|
CREATE TRIGGER tg_api_kgon_members_updated_at
|
|
|
|
BEFORE UPDATE
|
|
|
|
ON api_kgon_members
|
|
|
|
FOR EACH ROW
|
|
|
|
EXECUTE PROCEDURE update_updated_at_column();
|