nyanoblog/migrations/20221207230140_create_follows.sql

11 lines
418 B
MySQL
Raw Normal View History

2022-12-08 01:12:23 +01:00
CREATE TABLE follows (
id BIGSERIAL PRIMARY KEY,
2022-12-25 15:57:33 +01:00
iri VARCHAR,
2022-12-08 01:12:23 +01:00
follower_id BIGINT REFERENCES accounts (id) ON DELETE CASCADE,
followee_id BIGINT REFERENCES accounts (id) ON DELETE CASCADE,
2022-12-25 15:57:33 +01:00
created_at TIMESTAMP NOT NULL DEFAULT now()
2022-12-08 01:12:23 +01:00
);
2022-12-25 15:57:33 +01:00
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);