fef
a0d2dc4151
This is a major refactor that introduces a new generic type Id<T, I> for tagging any ID with the model they reference without any runtime overhead. From now on, it should be pretty much impossible to pass e.g. a note ID to a function that expects, say, an account ID. Furthermore, the follow and like tables have been simplified to use the two IDs that define the relationship as a composite primary key. Finally, likes now have a memory cache.
9 lines
332 B
SQL
9 lines
332 B
SQL
CREATE TABLE likes (
|
|
iri VARCHAR,
|
|
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(),
|
|
CONSTRAINT likes_pkey PRIMARY KEY (note_id, account_id)
|
|
);
|
|
|
|
CREATE UNIQUE INDEX index_likes_on_iri ON likes (iri);
|