diff --git a/readme.rst b/readme.rst index 63a55c3..85f71c2 100644 --- a/readme.rst +++ b/readme.rst @@ -1,6 +1,66 @@ ################### What is CodeIgniter ################### +the Database required for this application +-- Users table +CREATE TABLE users ( + user_id INT AUTO_INCREMENT PRIMARY KEY, + username VARCHAR(50) NOT NULL, + email VARCHAR(100) NOT NULL, + password_hash VARCHAR(255) NOT NULL, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +-- Forms table +CREATE TABLE forms ( + form_id INT AUTO_INCREMENT PRIMARY KEY, + user_id INT, + title VARCHAR(255) NOT NULL, + description TEXT, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY (user_id) REFERENCES Users(user_id) +); + +-- Questions table +CREATE TABLE questions ( + question_id INT AUTO_INCREMENT PRIMARY KEY, + form_id INT, + question_text TEXT NOT NULL, + question_type ENUM('multiple_choice', 'checkbox', 'short_answer') NOT NULL, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY (form_id) REFERENCES Forms(form_id) +); + +-- Options table +CREATE TABLE options ( + option_id INT AUTO_INCREMENT PRIMARY KEY, + question_id INT, + option_text VARCHAR(255) NOT NULL, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY (question_id) REFERENCES Questions(question_id) +); + +-- Responses table +CREATE TABLE responses ( + response_id INT AUTO_INCREMENT PRIMARY KEY, + form_id INT, + user_id INT, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY (form_id) REFERENCES Forms(form_id), + FOREIGN KEY (user_id) REFERENCES Users(user_id) +); + +-- Response_Answers table +CREATE TABLE response_answers ( + answer_id INT AUTO_INCREMENT PRIMARY KEY, + response_id INT, + question_id INT, + answer_text TEXT, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY (response_id) REFERENCES Responses(response_id), + FOREIGN KEY (question_id) REFERENCES Questions(question_id) +); + CodeIgniter is an Application Development Framework - a toolkit - for people who build web sites using PHP. Its goal is to enable you to develop projects