Refactor code structure for improved readability and maintainability; optimize performance across multiple modules.
All checks were successful
Deploy to production / deploy (push) Successful in 2m56s
All checks were successful
Deploy to production / deploy (push) Successful in 2m56s
This commit is contained in:
16
backend/migrations/20260716000000-create-user-block.sql
Normal file
16
backend/migrations/20260716000000-create-user-block.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
seiteBEGIN;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS community.user_block (
|
||||
id INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
blocker_id INTEGER NOT NULL REFERENCES community."user"(id) ON DELETE CASCADE,
|
||||
blocked_id INTEGER NOT NULL REFERENCES community."user"(id) ON DELETE CASCADE,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT user_block_not_self CHECK (blocker_id <> blocked_id),
|
||||
CONSTRAINT user_block_unique UNIQUE (blocker_id, blocked_id)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS user_block_blocker_id_idx
|
||||
ON community.user_block (blocker_id);
|
||||
|
||||
COMMIT;
|
||||
Reference in New Issue
Block a user