CREATE TABLE IF NOT EXISTS polls (
    id INTEGER PRIMARY KEY,
    question TEXT NOT NULL,
    member_yes_votes UNSIGNED INT NOT NULL,
    member_no_votes UNSIGNED INT NOT NULL,
    non_member_yes_votes UNSIGNED INT NOT NULL,
    non_member_no_votes UNSIGNED INT NOT NULL,
    created_at DATETIME,
    updated_at DATETIME,
    expires_at DATETIME
);

CREATE TABLE IF NOT EXISTS voters (
    poll_id UNSIGNED INT NOT NULL,
    voter_email TEXT NOT NULL,
    FOREIGN KEY (poll_id) REFERENCES polls(id),
    PRIMARY KEY (poll_id, voter_email)
);

CREATE TABLE IF NOT EXISTS members (
    email TEXT NOT NULL,
    member_name TEXT,
    PRIMARY KEY (email)
);
