- Added new course management functionalities in VocabController, including creating, updating, and deleting courses and lessons. - Implemented enrollment and progress tracking for courses, along with grammar exercise creation and management. - Updated database schema to include tables for courses, lessons, enrollments, and grammar exercises. - Enhanced frontend with new routes and views for course listing and details, including internationalization support for course-related texts. - Improved user experience by adding navigation to courses from the main vocab trainer view.
48 lines
1.6 KiB
JavaScript
48 lines
1.6 KiB
JavaScript
/* eslint-disable */
|
|
'use strict';
|
|
|
|
module.exports = {
|
|
async up(queryInterface) {
|
|
// chapter_id optional machen (nicht alle Lektionen brauchen ein Kapitel)
|
|
await queryInterface.sequelize.query(`
|
|
ALTER TABLE community.vocab_course_lesson
|
|
ALTER COLUMN chapter_id DROP NOT NULL;
|
|
`);
|
|
|
|
// Kurs-Wochen/Module hinzufügen
|
|
await queryInterface.sequelize.query(`
|
|
ALTER TABLE community.vocab_course_lesson
|
|
ADD COLUMN IF NOT EXISTS week_number INTEGER,
|
|
ADD COLUMN IF NOT EXISTS day_number INTEGER,
|
|
ADD COLUMN IF NOT EXISTS lesson_type TEXT DEFAULT 'vocab',
|
|
ADD COLUMN IF NOT EXISTS audio_url TEXT,
|
|
ADD COLUMN IF NOT EXISTS cultural_notes TEXT;
|
|
`);
|
|
|
|
// Indizes für Wochen/Tage
|
|
await queryInterface.sequelize.query(`
|
|
CREATE INDEX IF NOT EXISTS vocab_course_lesson_week_idx
|
|
ON community.vocab_course_lesson(course_id, week_number);
|
|
CREATE INDEX IF NOT EXISTS vocab_course_lesson_type_idx
|
|
ON community.vocab_course_lesson(lesson_type);
|
|
`);
|
|
|
|
// Kommentar hinzufügen für lesson_type
|
|
await queryInterface.sequelize.query(`
|
|
COMMENT ON COLUMN community.vocab_course_lesson.lesson_type IS
|
|
'Type: vocab, grammar, conversation, culture, review';
|
|
`);
|
|
},
|
|
|
|
async down(queryInterface) {
|
|
await queryInterface.sequelize.query(`
|
|
ALTER TABLE community.vocab_course_lesson
|
|
DROP COLUMN IF EXISTS week_number,
|
|
DROP COLUMN IF EXISTS day_number,
|
|
DROP COLUMN IF EXISTS lesson_type,
|
|
DROP COLUMN IF EXISTS audio_url,
|
|
DROP COLUMN IF EXISTS cultural_notes;
|
|
`);
|
|
}
|
|
};
|