feat(content-restrictions): add age rating and content rating support (#2619)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
-- Add age rating fields to book_metadata table for content restriction filtering
|
||||
ALTER TABLE book_metadata ADD COLUMN age_rating INT DEFAULT NULL;
|
||||
ALTER TABLE book_metadata ADD COLUMN content_rating VARCHAR(20) DEFAULT NULL;
|
||||
ALTER TABLE book_metadata ADD COLUMN age_rating_locked BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
ALTER TABLE book_metadata ADD COLUMN content_rating_locked BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
-- Create user_content_restriction table for per-user content filtering
|
||||
CREATE TABLE user_content_restriction (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
user_id BIGINT NOT NULL,
|
||||
restriction_type VARCHAR(20) NOT NULL,
|
||||
mode VARCHAR(15) NOT NULL,
|
||||
value VARCHAR(255) NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT fk_ucr_user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
|
||||
CONSTRAINT uk_user_restriction UNIQUE (user_id, restriction_type, value)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_ucr_user_id ON user_content_restriction(user_id);
|
||||
Reference in New Issue
Block a user