CREATE TABLE Requests (
request_id SERIAL PRIMARY KEY,
user_id INT REFERENCES Users(user_id),
entity_type VARCHAR(50) NOT NULL, -- Entity type (e.g., Word, Meaning)
entity_id INT, -- ID of the specific entity (word_id, meaning_id, etc.)
action VARCHAR(20) NOT NULL, -- Action (add, edit, delete)
new_data JSONB, -- JSON or JSONB column to store new data for the entity
request_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
status VARCHAR(20) DEFAULT 'pending' -- Status of the request (pending, approved, rejected)
);
CREATE TABLE Requests (
request_id SERIAL PRIMARY KEY,
user_id INT REFERENCES Users(user_id),
entity_type VARCHAR(50) NOT NULL, -- Entity type (e.g., Word, Meaning)
entity_id INT, -- ID of the specific entity (word_id, meaning_id, etc.)
action VARCHAR(20) NOT NULL, -- Action (add, edit, delete)
new_data JSONB, -- JSON or JSONB column to store new data for the entity
request_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
status VARCHAR(20) DEFAULT 'pending' -- Status of the request (pending, approved, rejected)
);