nyanoblog/migrations/20221211175753_create_likes.sql

11 lines
391 B
MySQL
Raw Normal View History

2022-12-11 20:44:06 +01:00
CREATE TABLE likes (
id BIGSERIAL PRIMARY KEY,
2022-12-25 15:57:33 +01:00
iri VARCHAR,
2022-12-11 20:44:06 +01:00
note_id BIGINT REFERENCES notes (id) ON DELETE CASCADE,
account_id BIGINT REFERENCES accounts (id) ON DELETE CASCADE,
created_at TIMESTAMP NOT NULL DEFAULT now()
);
2022-12-25 15:57:33 +01:00
CREATE UNIQUE INDEX index_likes_on_iri ON likes (iri);
2022-12-11 20:44:06 +01:00
CREATE UNIQUE INDEX index_likes_on_note_id_and_account_id ON likes (note_id, account_id);