-- mixes
CREATE TABLE mixes(
    id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(),
    recording_id VARCHAR(64) NOT NULL REFERENCES recordings(id) ON DELETE CASCADE,
    owner_id VARCHAR(64) NOT NULL REFERENCES users(id) ON DELETE CASCADE,
    description VARCHAR(1024) NOT NULL,
    spec TEXT NOT NULL,
    url VARCHAR(512) DEFAULT NULL,
    mix_server VARCHAR(64) DEFAULT NULL,
    started_at TIMESTAMP DEFAULT NULL,
    completed_at TIMESTAMP DEFAULT NULL,
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

CREATE INDEX index_started_at ON mixes USING btree (started_at);
CREATE INDEX index_completed_at ON mixes USING btree (completed_at);

