-- +goose Up
CREATE TABLE conferences (
    id int GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
    url text NOT NULL,
    title text,
    venue text,
    city text
);

TRUNCATE TABLE favourites CONTINUE IDENTITY;
ALTER TABLE favourites ADD conference_id int NOT NULL REFERENCES conferences(id) ON DELETE CASCADE;
ALTER TABLE favourites DROP CONSTRAINT favourites_user_id_event_guid_event_id_key;
ALTER TABLE favourites ADD UNIQUE(user_id, event_guid, event_id, conference_id);
