CREATE TABLE follows ( iri VARCHAR, follower_id BIGINT REFERENCES accounts (id) ON DELETE CASCADE, followee_id BIGINT REFERENCES accounts (id) ON DELETE CASCADE, created_at TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT follows_pkey PRIMARY KEY (follower_id, followee_id) ); CREATE UNIQUE INDEX index_follows_on_iri ON follows(iri);