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
352 B
SQL
9 lines
352 B
SQL
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);
|