CREATE TABLE users_followers (
    id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(),
    user_id VARCHAR(64) NOT NULL REFERENCES users(id) ON DELETE CASCADE,
    follower_id VARCHAR(64) NOT NULL REFERENCES users(id) ON DELETE CASCADE,
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

ALTER TABLE users_followers ADD CONSTRAINT user_follower_uniqkey UNIQUE (user_id, follower_id);

CREATE TABLE bands_followers (
	id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(),
    band_id VARCHAR(64) NOT NULL REFERENCES bands(id) ON DELETE CASCADE,
    follower_id VARCHAR(64) NOT NULL REFERENCES users(id) ON DELETE CASCADE,
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

ALTER TABLE bands_followers ADD CONSTRAINT band_follower_uniqkey UNIQUE (band_id, follower_id);