diff --git a/eLearning.sql b/eLearning.sql deleted file mode 100644 index b389321..0000000 --- a/eLearning.sql +++ /dev/null @@ -1,239 +0,0 @@ --- Roles table stores information about user roles -CREATE TABLE roles ( - id INT PRIMARY KEY AUTO_INCREMENT, - type VARCHAR(50) NOT NULL, - identity VARCHAR(100) NOT NULL, - created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -); - --- Users table stores information about all users -CREATE TABLE users ( - id INT PRIMARY KEY AUTO_INCREMENT, - name VARCHAR(255) NOT NULL, - contact VARCHAR(255) UNIQUE, - email VARCHAR(255) UNIQUE, - description TEXT, - password VARCHAR(255) NOT NULL, - role_id INT, - image VARCHAR(255), - remember_token VARCHAR(255), - status INT DEFAULT 1 COMMENT '1 active, 0 inactive', - access_block TEXT, - created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - deleted_at TIMESTAMP NULL, - FOREIGN KEY (role_id) REFERENCES roles(id) -); - --- Students table stores additional information about students -CREATE TABLE students ( - id INT PRIMARY KEY AUTO_INCREMENT, - name VARCHAR(255) NOT NULL, - contact VARCHAR(255) UNIQUE, - email VARCHAR(255) UNIQUE, - password VARCHAR(255) NOT NULL, - role_id INT, - date_of_birth DATE, - gender ENUM('male', 'female', 'other'), - image VARCHAR(255), - remember_token VARCHAR(255), - status INT DEFAULT 1 COMMENT '1 active, 0 inactive', - access_block TEXT, - created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - deleted_at TIMESTAMP NULL, - FOREIGN KEY (role_id) REFERENCES roles(id) -); - --- Instructors table stores additional information about instructors -CREATE TABLE instructors ( - id INT PRIMARY KEY AUTO_INCREMENT, - name VARCHAR(255) NOT NULL, - contact VARCHAR(255) UNIQUE, - email VARCHAR(255) UNIQUE, - password VARCHAR(255) NOT NULL, - role_id INT, - bio TEXT, - image VARCHAR(255), - remember_token VARCHAR(255), - status INT DEFAULT 1 COMMENT '1 active, 0 inactive', - access_block TEXT, - created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - deleted_at TIMESTAMP NULL, - FOREIGN KEY (role_id) REFERENCES roles(id) -); - --- Course Categories table stores information about course categories -CREATE TABLE course_categories ( - id INT PRIMARY KEY AUTO_INCREMENT, - category_name varchar(255) NOT NULL, - category_status tinyint(1) NOT NULL DEFAULT 1 COMMENT '1 active, 0 inactive', - category_image varchar(255) DEFAULT NULL, - created_at timestamp NULL DEFAULT NULL, - updated_at timestamp NULL DEFAULT NULL, - deleted_at timestamp NULL DEFAULT NULL, -); - --- Courses table stores information about each course -CREATE TABLE courses ( - id INT PRIMARY KEY AUTO_INCREMENT, - title VARCHAR(255) NOT NULL, - description TEXT, - category_id INT, - difficulty ENUM('beginner', 'intermediate', 'advanced') NOT NULL, - instructor_id INT, - price DECIMAL(10, 2) DEFAULT 0.00, - is_free BOOLEAN DEFAULT false, - is_subscription_based BOOLEAN DEFAULT false, - subscription_price DECIMAL(10, 2), - prerequisites TEXT, - image VARCHAR(255), - created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - FOREIGN KEY (instructor_id) REFERENCES instructors(id), - FOREIGN KEY (category_id) REFERENCES course_categories(id) -); - --- Enrollments table tracks which users are enrolled in which courses -CREATE TABLE enrollments ( - id INT PRIMARY KEY AUTO_INCREMENT, - student_id INT, - course_id INT, - enrollment_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - FOREIGN KEY (student_id) REFERENCES students(id), - FOREIGN KEY (course_id) REFERENCES courses(id) -); - --- Materials table stores various types of course materials -CREATE TABLE materials ( - id INT PRIMARY KEY AUTO_INCREMENT, - course_id INT, - title VARCHAR(255) NOT NULL, - type ENUM('video', 'document', 'quiz') NOT NULL, - content_url TEXT, - created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - FOREIGN KEY (course_id) REFERENCES courses(id) -); - --- Quizzes table stores information about quizzes -CREATE TABLE quizzes ( - id INT PRIMARY KEY AUTO_INCREMENT, - course_id INT, - title VARCHAR(255) NOT NULL, - created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - FOREIGN KEY (course_id) REFERENCES courses(id) -); - --- Questions table stores individual questions for quizzes -CREATE TABLE questions ( - id INT PRIMARY KEY AUTO_INCREMENT, - quiz_id INT, - content TEXT NOT NULL, - type ENUM('multiple_choice', 'true_false', 'short_answer') NOT NULL, - created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - FOREIGN KEY (quiz_id) REFERENCES quizzes(id) -); - --- Introduced a new table for multiple-choice options -CREATE TABLE options ( - id INT PRIMARY KEY AUTO_INCREMENT, - question_id INT, - option_text VARCHAR(255) NOT NULL, - is_correct BOOLEAN DEFAULT false, - FOREIGN KEY (question_id) REFERENCES questions(id) -); - --- User_answers table stores user responses to quiz questions -CREATE TABLE user_answers ( - id INT PRIMARY KEY AUTO_INCREMENT, - student_id INT, - question_id INT, - answer TEXT, - is_correct BOOLEAN, - created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - FOREIGN KEY (student_id) REFERENCES students(id), - FOREIGN KEY (question_id) REFERENCES questions(id) -); - --- Reviews table stores reviews for courses -CREATE TABLE reviews ( - id INT PRIMARY KEY AUTO_INCREMENT, - student_id INT, - course_id INT, - rating INT, - comment TEXT, - created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - FOREIGN KEY (student_id) REFERENCES students(id), - FOREIGN KEY (course_id) REFERENCES courses(id) -); - --- Payments table stores information about individual transactions -CREATE TABLE payments ( - id INT PRIMARY KEY AUTO_INCREMENT, - student_id INT, - course_id INT, - amount DECIMAL(10, 2) NOT NULL, - payment_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - payment_method VARCHAR(255), - transaction_id VARCHAR(255), - status ENUM('success', 'pending', 'failed') DEFAULT 'pending', - FOREIGN KEY (student_id) REFERENCES students(id), - FOREIGN KEY (course_id) REFERENCES courses(id) -); - --- Subscriptions table tracks user subscriptions -CREATE TABLE subscriptions ( - id INT PRIMARY KEY AUTO_INCREMENT, - student_id INT, - course_id INT, - plan ENUM('monthly', 'yearly') NOT NULL, - start_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - end_date TIMESTAMP, - status ENUM('active', 'canceled', 'expired') DEFAULT 'active', - FOREIGN KEY (student_id) REFERENCES students(id), - FOREIGN KEY (course_id) REFERENCES courses(id) -); - --- Course_progress table stores information about user progress in each course -CREATE TABLE course_progress ( - progress_id INT PRIMARY KEY AUTO_INCREMENT, - student_id INT, - course_id INT, - progress_percentage INT DEFAULT 0, - completed BOOLEAN DEFAULT false, - last_viewed_material_id INT, - last_viewed_at TIMESTAMP, - created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - FOREIGN KEY (student_id) REFERENCES students(id), - FOREIGN KEY (course_id) REFERENCES courses(id), - FOREIGN KEY (last_viewed_material_id) REFERENCES materials(id) -); - --- Discussions table stores discussions related to courses -CREATE TABLE discussions ( - discussion_id INT PRIMARY KEY AUTO_INCREMENT, - user_id INT, - course_id INT, - title VARCHAR(255) NOT NULL, - content TEXT, - created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - FOREIGN KEY (user_id) REFERENCES users(user_id), - FOREIGN KEY (course_id) REFERENCES courses(course_id) -); - --- Messages table stores direct messages between users -CREATE TABLE messages ( - message_id INT PRIMARY KEY AUTO_INCREMENT, - sender_id INT, - receiver_id INT, - content TEXT, - created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - FOREIGN KEY (sender_id) REFERENCES users(user_id), - FOREIGN KEY (receiver_id) REFERENCES users(user_id) -); \ No newline at end of file diff --git a/laravel_elearning.sql b/laravel_elearning.sql index 2432e57..e6d4b94 100644 --- a/laravel_elearning.sql +++ b/laravel_elearning.sql @@ -3,7 +3,7 @@ -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 --- Generation Time: Nov 29, 2023 at 08:06 AM +-- Generation Time: Dec 02, 2023 at 04:32 AM -- Server version: 10.4.27-MariaDB -- PHP Version: 8.2.0