10 lines
418 B
SQL
10 lines
418 B
SQL
CREATE TABLE follows (
|
|
id BIGSERIAL PRIMARY KEY,
|
|
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()
|
|
);
|
|
|
|
CREATE UNIQUE INDEX index_follows_on_iri ON follows(iri);
|
|
CREATE UNIQUE INDEX index_follows_on_follower_id_and_followee_id ON follows (follower_id, followee_id);
|