All checks were successful
Deploy Smart Search Backend / deploy (push) Successful in 1m41s
18 lines
553 B
SQL
18 lines
553 B
SQL
-- +goose Up
|
|
CREATE TABLE IF NOT EXISTS invite_codes (
|
|
id SERIAL PRIMARY KEY,
|
|
user_id INT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
|
code BIGINT NOT NULL UNIQUE,
|
|
can_be_used_count INT DEFAULT 10,
|
|
used_count INT DEFAULT 0,
|
|
is_active BOOLEAN DEFAULT true,
|
|
created_at TIMESTAMP DEFAULT now(),
|
|
expires_at TIMESTAMP NOT NULL
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_invite_codes_code ON invite_codes(code);
|
|
CREATE INDEX IF NOT EXISTS idx_invite_codes_user_id ON invite_codes(user_id);
|
|
|
|
-- +goose Down
|
|
DROP TABLE invite_codes;
|