CREATE TYPE album_permission AS ENUM ('view', 'contribute');

CREATE TABLE album_shares (
    album_id UUID NOT NULL REFERENCES albums (id) ON DELETE CASCADE,
    user_id UUID NOT NULL REFERENCES users (id) ON DELETE CASCADE,
    permission album_permission NOT NULL,
    PRIMARY KEY (album_id, user_id)
);

CREATE INDEX idx_album_shares_user_id ON album_shares (user_id);