209 lines
4.3 KiB
SQL
209 lines
4.3 KiB
SQL
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
|
|
|
-- ======================================================
|
|
-- Global Settings (LMS)
|
|
-- ======================================================
|
|
INSERT INTO global_settings (key, value)
|
|
VALUES
|
|
('platform_name', 'Yimaru LMS'),
|
|
('default_language', 'en'),
|
|
('allow_self_signup', 'true'),
|
|
('otp_expiry_minutes', '5'),
|
|
('certificate_enabled', 'true'),
|
|
('max_courses_per_instructor', '50')
|
|
ON CONFLICT (key) DO NOTHING;
|
|
-- ======================================================
|
|
|
|
INSERT INTO users (
|
|
id,
|
|
first_name,
|
|
last_name,
|
|
user_name,
|
|
email,
|
|
phone_number,
|
|
role,
|
|
password,
|
|
age,
|
|
education_level,
|
|
country,
|
|
region,
|
|
knowledge_level,
|
|
nick_name,
|
|
occupation,
|
|
learning_goal,
|
|
language_goal,
|
|
language_challange,
|
|
favoutite_topic,
|
|
initial_assessment_completed,
|
|
email_verified,
|
|
phone_verified,
|
|
status,
|
|
last_login,
|
|
profile_completed,
|
|
profile_picture_url,
|
|
preferred_language,
|
|
created_at,
|
|
updated_at
|
|
)
|
|
VALUES
|
|
(
|
|
1,
|
|
'Sarah',
|
|
'Connor',
|
|
'SarahC',
|
|
'yaredyemane1@gmail.com',
|
|
NULL,
|
|
'SUPER_ADMIN',
|
|
crypt('password@123', gen_salt('bf'))::bytea,
|
|
35,
|
|
'Masters',
|
|
'USA',
|
|
'California',
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
'ACTIVE',
|
|
NULL,
|
|
FALSE,
|
|
NULL,
|
|
'en',
|
|
CURRENT_TIMESTAMP,
|
|
CURRENT_TIMESTAMP
|
|
),
|
|
(
|
|
2,
|
|
'Test',
|
|
'Instructor',
|
|
'InstructorT',
|
|
'instructor@yimaru.com',
|
|
'0988554466',
|
|
'INSTRUCTOR',
|
|
crypt('password@123', gen_salt('bf'))::bytea,
|
|
30,
|
|
'Bachelors',
|
|
'USA',
|
|
'New York',
|
|
NULL,
|
|
NULL,
|
|
'Instructor',
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
'ACTIVE',
|
|
NULL,
|
|
FALSE,
|
|
NULL,
|
|
'en',
|
|
CURRENT_TIMESTAMP,
|
|
CURRENT_TIMESTAMP
|
|
),
|
|
(
|
|
3,
|
|
'Demo',
|
|
'Student',
|
|
'DemoS',
|
|
'student@yimaru.com',
|
|
NULL,
|
|
'STUDENT',
|
|
crypt('password@123', gen_salt('bf'))::bytea,
|
|
22,
|
|
'High School',
|
|
'USA',
|
|
'Texas',
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
FALSE,
|
|
TRUE,
|
|
FALSE,
|
|
'ACTIVE',
|
|
NULL,
|
|
FALSE,
|
|
NULL,
|
|
'en',
|
|
CURRENT_TIMESTAMP,
|
|
CURRENT_TIMESTAMP
|
|
)
|
|
ON CONFLICT (id) DO UPDATE
|
|
SET first_name = EXCLUDED.first_name,
|
|
last_name = EXCLUDED.last_name,
|
|
user_name = EXCLUDED.user_name,
|
|
email = EXCLUDED.email,
|
|
phone_number = EXCLUDED.phone_number,
|
|
role = EXCLUDED.role,
|
|
password = EXCLUDED.password,
|
|
age = EXCLUDED.age,
|
|
education_level = EXCLUDED.education_level,
|
|
country = EXCLUDED.country,
|
|
region = EXCLUDED.region,
|
|
knowledge_level = EXCLUDED.knowledge_level,
|
|
nick_name = EXCLUDED.nick_name,
|
|
occupation = EXCLUDED.occupation,
|
|
learning_goal = EXCLUDED.learning_goal,
|
|
language_goal = EXCLUDED.language_goal,
|
|
language_challange = EXCLUDED.language_challange,
|
|
favoutite_topic = EXCLUDED.favoutite_topic,
|
|
initial_assessment_completed = EXCLUDED.initial_assessment_completed,
|
|
email_verified = EXCLUDED.email_verified,
|
|
phone_verified = EXCLUDED.phone_verified,
|
|
status = EXCLUDED.status,
|
|
last_login = EXCLUDED.last_login,
|
|
profile_completed = EXCLUDED.profile_completed,
|
|
profile_picture_url = EXCLUDED.profile_picture_url,
|
|
preferred_language = EXCLUDED.preferred_language,
|
|
updated_at = CURRENT_TIMESTAMP;
|
|
|
|
-- ======================================================
|
|
-- Courses
|
|
-- ======================================================
|
|
-- ======================================================
|
|
-- Course Categories
|
|
-- ======================================================
|
|
INSERT INTO course_categories (
|
|
id,
|
|
name,
|
|
is_active,
|
|
created_at
|
|
)
|
|
VALUES
|
|
(1, 'Learning English', TRUE, CURRENT_TIMESTAMP),
|
|
(2, 'Other Courses', TRUE, CURRENT_TIMESTAMP)
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
-- ======================================================
|
|
-- Notifications (Sample)
|
|
-- ======================================================
|
|
INSERT INTO notifications (
|
|
user_id,
|
|
type,
|
|
level,
|
|
channel,
|
|
title,
|
|
message,
|
|
created_at
|
|
)
|
|
VALUES (
|
|
3,
|
|
'course_enrolled',
|
|
'info',
|
|
'in_app',
|
|
'Welcome to your course',
|
|
'You have successfully enrolled in Introduction to Go Programming.',
|
|
CURRENT_TIMESTAMP
|
|
);
|