-- +goose Up
CREATE TABLE
    IF NOT EXISTS teams (
        id SERIAL PRIMARY KEY,
        name VARCHAR(255) NOT NULL,
        status VARCHAR(50) DEFAULT 'register',
        creator_id INTEGER NOT NULL,
        game_id INTEGER NOT NULL,
        password TEXT,
        created_at TIMESTAMP NOT NULL DEFAULT NOW (),

        CONSTRAINT fk_teams_game FOREIGN KEY (game_id) REFERENCES games (id) ON DELETE RESTRICT,
        CONSTRAINT fk_teams_creator FOREIGN KEY (creator_id) REFERENCES users (id) ON DELETE RESTRICT
    );

-- +goose Down
DROP TABLE IF EXISTS teams;
