-- migrate:up
CREATE TABLE events (
    id SERIAL PRIMARY KEY,
    "name" TEXT NOT NULL,
    description TEXT NOT NULL,
    start_date DATE NOT NULL,
    end_date DATE NOT NULL,
    setup_start_date DATE,
    setup_end_date DATE,
    location TEXT NOT NULL
);

-- The organizing committee: which users are attached to which event.
CREATE TABLE event_committee (
    event_id INTEGER NOT NULL REFERENCES events (id) ON DELETE CASCADE,
    user_id INTEGER NOT NULL REFERENCES users (id) ON DELETE CASCADE,
    PRIMARY KEY (event_id, user_id)
);

-- migrate:down
DROP TABLE IF EXISTS event_committee;
DROP TABLE IF EXISTS events;
