





















const db = require('../models');
const Users = db.users;






const Subjects = db.subjects;

const GradeLevels = db.grade_levels;

const Textbooks = db.textbooks;

const Chapters = db.chapters;

const CurriculumStandards = db.curriculum_standards;

const Skills = db.skills;

const QuestionBanks = db.question_banks;

const Questions = db.questions;

const AnswerChoices = db.answer_choices;

const Tests = db.tests;

const TestSections = db.test_sections;

const TestItems = db.test_items;

const TestVersions = db.test_versions;

const VersionItems = db.version_items;

const VersionAnswerOrders = db.version_answer_orders;

const Exports = db.exports;

const AnswerKeys = db.answer_keys;

const ScoringSchemes = db.scoring_schemes;

const TestMatrices = db.test_matrices;

const MatrixRows = db.matrix_rows;

const Collections = db.collections;

const AiGenerationJobs = db.ai_generation_jobs;







const SubjectsData = [
    
    {
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                "code": "Marie Curie",
            
        
    
        
        
            
                "description": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                "code": "Alan Turing",
            
        
    
        
        
            
                "description": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                "code": "Marie Curie",
            
        
    
        
        
            
                "description": "Marie Curie",
            
        
    
    },
    
];



const GradeLevelsData = [
    
    {
    
        
        
            
                "name": "Alan Turing",
            
        
    
        
        
            
                "sort_order": 3,
            
        
    
        
        
            
                "description": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                "sort_order": 8,
            
        
    
        
        
            
                "description": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
        
        
            
                "sort_order": 8,
            
        
    
        
        
            
                "description": "Ada Lovelace",
            
        
    
    },
    
];



const TextbooksData = [
    
    {
    
        
        
            
                "title": "Alan Turing",
            
        
    
        
        
            
                "publisher": "Ada Lovelace",
            
        
    
        
        
            
                "edition": "Alan Turing",
            
        
    
        
        
            
                "isbn": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "title": "Marie Curie",
            
        
    
        
        
            
                "publisher": "Marie Curie",
            
        
    
        
        
            
                "edition": "Ada Lovelace",
            
        
    
        
        
            
                "isbn": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "title": "Ada Lovelace",
            
        
    
        
        
            
                "publisher": "Alan Turing",
            
        
    
        
        
            
                "edition": "Ada Lovelace",
            
        
    
        
        
            
                "isbn": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const ChaptersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Alan Turing",
            
        
    
        
        
            
                "chapter_number": "Grace Hopper",
            
        
    
        
        
            
                "sort_order": 4,
            
        
    
        
        
            
                "summary": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Grace Hopper",
            
        
    
        
        
            
                "chapter_number": "Ada Lovelace",
            
        
    
        
        
            
                "sort_order": 9,
            
        
    
        
        
            
                "summary": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Alan Turing",
            
        
    
        
        
            
                "chapter_number": "Ada Lovelace",
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
        
        
            
                "summary": "Ada Lovelace",
            
        
    
    },
    
];



const CurriculumStandardsData = [
    
    {
    
        
        
            
                "code": "Marie Curie",
            
        
    
        
        
            
                "description": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "competency_area": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                "code": "Ada Lovelace",
            
        
    
        
        
            
                "description": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "competency_area": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "code": "Marie Curie",
            
        
    
        
        
            
                "description": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "competency_area": "Marie Curie",
            
        
    
    },
    
];



const SkillsData = [
    
    {
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                "description": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
        
        
            
                "description": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                "description": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const QuestionBanksData = [
    
    {
    
        
        
            
                "name": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_public": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_public": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_public": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Marie Curie",
            
        
    
    },
    
];



const QuestionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "question_type": "single_choice",
            
        
    
        
        
            
                "difficulty": "medium",
            
        
    
        
        
            
                "content": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "default_points": 4.46,
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                "hint": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "question_type": "true_false",
            
        
    
        
        
            
                "difficulty": "very_easy",
            
        
    
        
        
            
                "content": "Marie Curie",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "default_points": 2.34,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "hint": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "question_type": "true_false",
            
        
    
        
        
            
                "difficulty": "medium",
            
        
    
        
        
            
                "content": "Marie Curie",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "default_points": 0.45,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "hint": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
];



const AnswerChoicesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "content": "Alan Turing",
            
        
    
        
        
            
                "is_correct": false,
            
        
    
        
        
            
                "sort_order": 6,
            
        
    
        
        
            
                "feedback": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "content": "Grace Hopper",
            
        
    
        
        
            
                "is_correct": false,
            
        
    
        
        
            
                "sort_order": 5,
            
        
    
        
        
            
                "feedback": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "content": "Ada Lovelace",
            
        
    
        
        
            
                "is_correct": true,
            
        
    
        
        
            
                "sort_order": 9,
            
        
    
        
        
            
                "feedback": "Marie Curie",
            
        
    
    },
    
];



const TestsData = [
    
    {
    
        
        
            
                "title": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "build_mode": "automatic",
            
        
    
        
        
            
                "status": "archived",
            
        
    
        
        
            
                "target_question_count": 3,
            
        
    
        
        
            
                "target_total_points": 8.53,
            
        
    
        
        
            
                "target_average_difficulty": 9.13,
            
        
    
        
        
            
                "shuffle_questions": false,
            
        
    
        
        
            
                "shuffle_answers": true,
            
        
    
        
        
            
                "assigned_at": new Date(Date.now()),
            
        
    
        
        
            
                "due_at": new Date(Date.now()),
            
        
    
        
        
            
                "instructions": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                "title": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "build_mode": "manual",
            
        
    
        
        
            
                "status": "ready",
            
        
    
        
        
            
                "target_question_count": 2,
            
        
    
        
        
            
                "target_total_points": 1.71,
            
        
    
        
        
            
                "target_average_difficulty": 5.83,
            
        
    
        
        
            
                "shuffle_questions": true,
            
        
    
        
        
            
                "shuffle_answers": true,
            
        
    
        
        
            
                "assigned_at": new Date(Date.now()),
            
        
    
        
        
            
                "due_at": new Date(Date.now()),
            
        
    
        
        
            
                "instructions": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                "title": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "build_mode": "automatic",
            
        
    
        
        
            
                "status": "archived",
            
        
    
        
        
            
                "target_question_count": 9,
            
        
    
        
        
            
                "target_total_points": 4.78,
            
        
    
        
        
            
                "target_average_difficulty": 8.09,
            
        
    
        
        
            
                "shuffle_questions": true,
            
        
    
        
        
            
                "shuffle_answers": false,
            
        
    
        
        
            
                "assigned_at": new Date(Date.now()),
            
        
    
        
        
            
                "due_at": new Date(Date.now()),
            
        
    
        
        
            
                "instructions": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
];



const TestSectionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Ada Lovelace",
            
        
    
        
        
            
                "sort_order": 3,
            
        
    
        
        
            
                "description": "Marie Curie",
            
        
    
        
        
            
                "max_points": 1.72,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Alan Turing",
            
        
    
        
        
            
                "sort_order": 6,
            
        
    
        
        
            
                "description": "Marie Curie",
            
        
    
        
        
            
                "max_points": 1.24,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Ada Lovelace",
            
        
    
        
        
            
                "sort_order": 4,
            
        
    
        
        
            
                "description": "Alan Turing",
            
        
    
        
        
            
                "max_points": 4.91,
            
        
    
    },
    
];



const TestItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sort_order": 2,
            
        
    
        
        
            
                "points": 0.14,
            
        
    
        
        
            
                "override_content": "Grace Hopper",
            
        
    
        
        
            
                "is_bonus": false,
            
        
    
        
        
            
                "scoring_rubric": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sort_order": 6,
            
        
    
        
        
            
                "points": 1.97,
            
        
    
        
        
            
                "override_content": "Ada Lovelace",
            
        
    
        
        
            
                "is_bonus": true,
            
        
    
        
        
            
                "scoring_rubric": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sort_order": 9,
            
        
    
        
        
            
                "points": 6.58,
            
        
    
        
        
            
                "override_content": "Grace Hopper",
            
        
    
        
        
            
                "is_bonus": true,
            
        
    
        
        
            
                "scoring_rubric": "Grace Hopper",
            
        
    
    },
    
];



const TestVersionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "version_label": "Marie Curie",
            
        
    
        
        
            
                "generation_strategy": "both",
            
        
    
        
        
            
                "is_locked": true,
            
        
    
        
        
            
                "generated_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "version_label": "Marie Curie",
            
        
    
        
        
            
                "generation_strategy": "shuffle_answers",
            
        
    
        
        
            
                "is_locked": false,
            
        
    
        
        
            
                "generated_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "version_label": "Ada Lovelace",
            
        
    
        
        
            
                "generation_strategy": "shuffle_answers",
            
        
    
        
        
            
                "is_locked": false,
            
        
    
        
        
            
                "generated_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const VersionItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "display_order": 8,
            
        
    
        
        
            
                "rendered_content": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "display_order": 6,
            
        
    
        
        
            
                "rendered_content": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "display_order": 5,
            
        
    
        
        
            
                "rendered_content": "Marie Curie",
            
        
    
    },
    
];



const VersionAnswerOrdersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "answer_order": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "answer_order": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "answer_order": "Alan Turing",
            
        
    
    },
    
];



const ExportsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "file_type": "docx",
            
        
    
        
        
            
                "status": "processing",
            
        
    
        
        
            
                "requested_at": new Date(Date.now()),
            
        
    
        
        
            
                "completed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "error_message": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "file_type": "pdf",
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                "requested_at": new Date(Date.now()),
            
        
    
        
        
            
                "completed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "error_message": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "file_type": "pdf",
            
        
    
        
        
            
                "status": "queued",
            
        
    
        
        
            
                "requested_at": new Date(Date.now()),
            
        
    
        
        
            
                "completed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "error_message": "Marie Curie",
            
        
    
    },
    
];



const AnswerKeysData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "content": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "content": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "content": "Alan Turing",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const ScoringSchemesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "content": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "content": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "content": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const TestMatricesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Alan Turing",
            
        
    
        
        
            
                "content": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Ada Lovelace",
            
        
    
        
        
            
                "content": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Alan Turing",
            
        
    
        
        
            
                "content": "Alan Turing",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const MatrixRowsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "weight": 7.42,
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "weight": 0.43,
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "weight": 9.58,
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
];



const CollectionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                "description": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Alan Turing",
            
        
    
        
        
            
                "description": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                "description": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
];



const AiGenerationJobsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "running",
            
        
    
        
        
            
                "requested_count": 1,
            
        
    
        
        
            
                "difficulty_target": "easy",
            
        
    
        
        
            
                "started_at": new Date(Date.now()),
            
        
    
        
        
            
                "finished_at": new Date(Date.now()),
            
        
    
        
        
            
                "prompt": "Grace Hopper",
            
        
    
        
        
            
                "error_message": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "running",
            
        
    
        
        
            
                "requested_count": 1,
            
        
    
        
        
            
                "difficulty_target": "very_easy",
            
        
    
        
        
            
                "started_at": new Date(Date.now()),
            
        
    
        
        
            
                "finished_at": new Date(Date.now()),
            
        
    
        
        
            
                "prompt": "Ada Lovelace",
            
        
    
        
        
            
                "error_message": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "running",
            
        
    
        
        
            
                "requested_count": 2,
            
        
    
        
        
            
                "difficulty_target": "very_hard",
            
        
    
        
        
            
                "started_at": new Date(Date.now()),
            
        
    
        
        
            
                "finished_at": new Date(Date.now()),
            
        
    
        
        
            
                "prompt": "Marie Curie",
            
        
    
        
        
            
                "error_message": "Grace Hopper",
            
        
    
    },
    
];




    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
    
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
            
            async function associateTextbookWithSubject() {
            
                const relatedSubject0 = await Subjects.findOne({
                    offset: Math.floor(Math.random() * (await Subjects.count())),
                });
                const Textbook0 = await Textbooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Textbook0?.setSubject)
                {
                    await
                    Textbook0.
                    setSubject(relatedSubject0);
                }
            
                const relatedSubject1 = await Subjects.findOne({
                    offset: Math.floor(Math.random() * (await Subjects.count())),
                });
                const Textbook1 = await Textbooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Textbook1?.setSubject)
                {
                    await
                    Textbook1.
                    setSubject(relatedSubject1);
                }
            
                const relatedSubject2 = await Subjects.findOne({
                    offset: Math.floor(Math.random() * (await Subjects.count())),
                });
                const Textbook2 = await Textbooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Textbook2?.setSubject)
                {
                    await
                    Textbook2.
                    setSubject(relatedSubject2);
                }
            
        }
        
    
        
            
            async function associateTextbookWithGrade_level() {
            
                const relatedGrade_level0 = await GradeLevels.findOne({
                    offset: Math.floor(Math.random() * (await GradeLevels.count())),
                });
                const Textbook0 = await Textbooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Textbook0?.setGrade_level)
                {
                    await
                    Textbook0.
                    setGrade_level(relatedGrade_level0);
                }
            
                const relatedGrade_level1 = await GradeLevels.findOne({
                    offset: Math.floor(Math.random() * (await GradeLevels.count())),
                });
                const Textbook1 = await Textbooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Textbook1?.setGrade_level)
                {
                    await
                    Textbook1.
                    setGrade_level(relatedGrade_level1);
                }
            
                const relatedGrade_level2 = await GradeLevels.findOne({
                    offset: Math.floor(Math.random() * (await GradeLevels.count())),
                });
                const Textbook2 = await Textbooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Textbook2?.setGrade_level)
                {
                    await
                    Textbook2.
                    setGrade_level(relatedGrade_level2);
                }
            
        }
        
    
        
    

    
    
    
        
            
            async function associateChapterWithTextbook() {
            
                const relatedTextbook0 = await Textbooks.findOne({
                    offset: Math.floor(Math.random() * (await Textbooks.count())),
                });
                const Chapter0 = await Chapters.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Chapter0?.setTextbook)
                {
                    await
                    Chapter0.
                    setTextbook(relatedTextbook0);
                }
            
                const relatedTextbook1 = await Textbooks.findOne({
                    offset: Math.floor(Math.random() * (await Textbooks.count())),
                });
                const Chapter1 = await Chapters.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Chapter1?.setTextbook)
                {
                    await
                    Chapter1.
                    setTextbook(relatedTextbook1);
                }
            
                const relatedTextbook2 = await Textbooks.findOne({
                    offset: Math.floor(Math.random() * (await Textbooks.count())),
                });
                const Chapter2 = await Chapters.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Chapter2?.setTextbook)
                {
                    await
                    Chapter2.
                    setTextbook(relatedTextbook2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
            
            async function associateCurriculumStandardWithSubject() {
            
                const relatedSubject0 = await Subjects.findOne({
                    offset: Math.floor(Math.random() * (await Subjects.count())),
                });
                const CurriculumStandard0 = await CurriculumStandards.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CurriculumStandard0?.setSubject)
                {
                    await
                    CurriculumStandard0.
                    setSubject(relatedSubject0);
                }
            
                const relatedSubject1 = await Subjects.findOne({
                    offset: Math.floor(Math.random() * (await Subjects.count())),
                });
                const CurriculumStandard1 = await CurriculumStandards.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CurriculumStandard1?.setSubject)
                {
                    await
                    CurriculumStandard1.
                    setSubject(relatedSubject1);
                }
            
                const relatedSubject2 = await Subjects.findOne({
                    offset: Math.floor(Math.random() * (await Subjects.count())),
                });
                const CurriculumStandard2 = await CurriculumStandards.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CurriculumStandard2?.setSubject)
                {
                    await
                    CurriculumStandard2.
                    setSubject(relatedSubject2);
                }
            
        }
        
    
        
            
            async function associateCurriculumStandardWithGrade_level() {
            
                const relatedGrade_level0 = await GradeLevels.findOne({
                    offset: Math.floor(Math.random() * (await GradeLevels.count())),
                });
                const CurriculumStandard0 = await CurriculumStandards.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CurriculumStandard0?.setGrade_level)
                {
                    await
                    CurriculumStandard0.
                    setGrade_level(relatedGrade_level0);
                }
            
                const relatedGrade_level1 = await GradeLevels.findOne({
                    offset: Math.floor(Math.random() * (await GradeLevels.count())),
                });
                const CurriculumStandard1 = await CurriculumStandards.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CurriculumStandard1?.setGrade_level)
                {
                    await
                    CurriculumStandard1.
                    setGrade_level(relatedGrade_level1);
                }
            
                const relatedGrade_level2 = await GradeLevels.findOne({
                    offset: Math.floor(Math.random() * (await GradeLevels.count())),
                });
                const CurriculumStandard2 = await CurriculumStandards.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CurriculumStandard2?.setGrade_level)
                {
                    await
                    CurriculumStandard2.
                    setGrade_level(relatedGrade_level2);
                }
            
        }
        
    
        
    

    
    
    
        
    
        
    
        
            
            async function associateSkillWithStandard() {
            
                const relatedStandard0 = await CurriculumStandards.findOne({
                    offset: Math.floor(Math.random() * (await CurriculumStandards.count())),
                });
                const Skill0 = await Skills.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Skill0?.setStandard)
                {
                    await
                    Skill0.
                    setStandard(relatedStandard0);
                }
            
                const relatedStandard1 = await CurriculumStandards.findOne({
                    offset: Math.floor(Math.random() * (await CurriculumStandards.count())),
                });
                const Skill1 = await Skills.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Skill1?.setStandard)
                {
                    await
                    Skill1.
                    setStandard(relatedStandard1);
                }
            
                const relatedStandard2 = await CurriculumStandards.findOne({
                    offset: Math.floor(Math.random() * (await CurriculumStandards.count())),
                });
                const Skill2 = await Skills.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Skill2?.setStandard)
                {
                    await
                    Skill2.
                    setStandard(relatedStandard2);
                }
            
        }
        
    

    
    
    
        
    
        
            
            async function associateQuestionBankWithSubject() {
            
                const relatedSubject0 = await Subjects.findOne({
                    offset: Math.floor(Math.random() * (await Subjects.count())),
                });
                const QuestionBank0 = await QuestionBanks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QuestionBank0?.setSubject)
                {
                    await
                    QuestionBank0.
                    setSubject(relatedSubject0);
                }
            
                const relatedSubject1 = await Subjects.findOne({
                    offset: Math.floor(Math.random() * (await Subjects.count())),
                });
                const QuestionBank1 = await QuestionBanks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QuestionBank1?.setSubject)
                {
                    await
                    QuestionBank1.
                    setSubject(relatedSubject1);
                }
            
                const relatedSubject2 = await Subjects.findOne({
                    offset: Math.floor(Math.random() * (await Subjects.count())),
                });
                const QuestionBank2 = await QuestionBanks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QuestionBank2?.setSubject)
                {
                    await
                    QuestionBank2.
                    setSubject(relatedSubject2);
                }
            
        }
        
    
        
            
            async function associateQuestionBankWithGrade_level() {
            
                const relatedGrade_level0 = await GradeLevels.findOne({
                    offset: Math.floor(Math.random() * (await GradeLevels.count())),
                });
                const QuestionBank0 = await QuestionBanks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QuestionBank0?.setGrade_level)
                {
                    await
                    QuestionBank0.
                    setGrade_level(relatedGrade_level0);
                }
            
                const relatedGrade_level1 = await GradeLevels.findOne({
                    offset: Math.floor(Math.random() * (await GradeLevels.count())),
                });
                const QuestionBank1 = await QuestionBanks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QuestionBank1?.setGrade_level)
                {
                    await
                    QuestionBank1.
                    setGrade_level(relatedGrade_level1);
                }
            
                const relatedGrade_level2 = await GradeLevels.findOne({
                    offset: Math.floor(Math.random() * (await GradeLevels.count())),
                });
                const QuestionBank2 = await QuestionBanks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QuestionBank2?.setGrade_level)
                {
                    await
                    QuestionBank2.
                    setGrade_level(relatedGrade_level2);
                }
            
        }
        
    
        
            
            async function associateQuestionBankWithTextbook() {
            
                const relatedTextbook0 = await Textbooks.findOne({
                    offset: Math.floor(Math.random() * (await Textbooks.count())),
                });
                const QuestionBank0 = await QuestionBanks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QuestionBank0?.setTextbook)
                {
                    await
                    QuestionBank0.
                    setTextbook(relatedTextbook0);
                }
            
                const relatedTextbook1 = await Textbooks.findOne({
                    offset: Math.floor(Math.random() * (await Textbooks.count())),
                });
                const QuestionBank1 = await QuestionBanks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QuestionBank1?.setTextbook)
                {
                    await
                    QuestionBank1.
                    setTextbook(relatedTextbook1);
                }
            
                const relatedTextbook2 = await Textbooks.findOne({
                    offset: Math.floor(Math.random() * (await Textbooks.count())),
                });
                const QuestionBank2 = await QuestionBanks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QuestionBank2?.setTextbook)
                {
                    await
                    QuestionBank2.
                    setTextbook(relatedTextbook2);
                }
            
        }
        
    
        
    
        
            
            async function associateQuestionBankWithOwner_user() {
            
                const relatedOwner_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const QuestionBank0 = await QuestionBanks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QuestionBank0?.setOwner_user)
                {
                    await
                    QuestionBank0.
                    setOwner_user(relatedOwner_user0);
                }
            
                const relatedOwner_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const QuestionBank1 = await QuestionBanks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QuestionBank1?.setOwner_user)
                {
                    await
                    QuestionBank1.
                    setOwner_user(relatedOwner_user1);
                }
            
                const relatedOwner_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const QuestionBank2 = await QuestionBanks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QuestionBank2?.setOwner_user)
                {
                    await
                    QuestionBank2.
                    setOwner_user(relatedOwner_user2);
                }
            
        }
        
    
        
    

    
    
    
        
            
            async function associateQuestionWithQuestion_bank() {
            
                const relatedQuestion_bank0 = await QuestionBanks.findOne({
                    offset: Math.floor(Math.random() * (await QuestionBanks.count())),
                });
                const Question0 = await Questions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Question0?.setQuestion_bank)
                {
                    await
                    Question0.
                    setQuestion_bank(relatedQuestion_bank0);
                }
            
                const relatedQuestion_bank1 = await QuestionBanks.findOne({
                    offset: Math.floor(Math.random() * (await QuestionBanks.count())),
                });
                const Question1 = await Questions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Question1?.setQuestion_bank)
                {
                    await
                    Question1.
                    setQuestion_bank(relatedQuestion_bank1);
                }
            
                const relatedQuestion_bank2 = await QuestionBanks.findOne({
                    offset: Math.floor(Math.random() * (await QuestionBanks.count())),
                });
                const Question2 = await Questions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Question2?.setQuestion_bank)
                {
                    await
                    Question2.
                    setQuestion_bank(relatedQuestion_bank2);
                }
            
        }
        
    
        
            
            async function associateQuestionWithChapter() {
            
                const relatedChapter0 = await Chapters.findOne({
                    offset: Math.floor(Math.random() * (await Chapters.count())),
                });
                const Question0 = await Questions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Question0?.setChapter)
                {
                    await
                    Question0.
                    setChapter(relatedChapter0);
                }
            
                const relatedChapter1 = await Chapters.findOne({
                    offset: Math.floor(Math.random() * (await Chapters.count())),
                });
                const Question1 = await Questions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Question1?.setChapter)
                {
                    await
                    Question1.
                    setChapter(relatedChapter1);
                }
            
                const relatedChapter2 = await Chapters.findOne({
                    offset: Math.floor(Math.random() * (await Chapters.count())),
                });
                const Question2 = await Questions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Question2?.setChapter)
                {
                    await
                    Question2.
                    setChapter(relatedChapter2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
        
            
            async function associateAnswerChoiceWithQuestion() {
            
                const relatedQuestion0 = await Questions.findOne({
                    offset: Math.floor(Math.random() * (await Questions.count())),
                });
                const AnswerChoice0 = await AnswerChoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AnswerChoice0?.setQuestion)
                {
                    await
                    AnswerChoice0.
                    setQuestion(relatedQuestion0);
                }
            
                const relatedQuestion1 = await Questions.findOne({
                    offset: Math.floor(Math.random() * (await Questions.count())),
                });
                const AnswerChoice1 = await AnswerChoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AnswerChoice1?.setQuestion)
                {
                    await
                    AnswerChoice1.
                    setQuestion(relatedQuestion1);
                }
            
                const relatedQuestion2 = await Questions.findOne({
                    offset: Math.floor(Math.random() * (await Questions.count())),
                });
                const AnswerChoice2 = await AnswerChoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AnswerChoice2?.setQuestion)
                {
                    await
                    AnswerChoice2.
                    setQuestion(relatedQuestion2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateTestWithOwner_user() {
            
                const relatedOwner_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Test0 = await Tests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Test0?.setOwner_user)
                {
                    await
                    Test0.
                    setOwner_user(relatedOwner_user0);
                }
            
                const relatedOwner_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Test1 = await Tests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Test1?.setOwner_user)
                {
                    await
                    Test1.
                    setOwner_user(relatedOwner_user1);
                }
            
                const relatedOwner_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Test2 = await Tests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Test2?.setOwner_user)
                {
                    await
                    Test2.
                    setOwner_user(relatedOwner_user2);
                }
            
        }
        
    
        
            
            async function associateTestWithSubject() {
            
                const relatedSubject0 = await Subjects.findOne({
                    offset: Math.floor(Math.random() * (await Subjects.count())),
                });
                const Test0 = await Tests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Test0?.setSubject)
                {
                    await
                    Test0.
                    setSubject(relatedSubject0);
                }
            
                const relatedSubject1 = await Subjects.findOne({
                    offset: Math.floor(Math.random() * (await Subjects.count())),
                });
                const Test1 = await Tests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Test1?.setSubject)
                {
                    await
                    Test1.
                    setSubject(relatedSubject1);
                }
            
                const relatedSubject2 = await Subjects.findOne({
                    offset: Math.floor(Math.random() * (await Subjects.count())),
                });
                const Test2 = await Tests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Test2?.setSubject)
                {
                    await
                    Test2.
                    setSubject(relatedSubject2);
                }
            
        }
        
    
        
            
            async function associateTestWithGrade_level() {
            
                const relatedGrade_level0 = await GradeLevels.findOne({
                    offset: Math.floor(Math.random() * (await GradeLevels.count())),
                });
                const Test0 = await Tests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Test0?.setGrade_level)
                {
                    await
                    Test0.
                    setGrade_level(relatedGrade_level0);
                }
            
                const relatedGrade_level1 = await GradeLevels.findOne({
                    offset: Math.floor(Math.random() * (await GradeLevels.count())),
                });
                const Test1 = await Tests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Test1?.setGrade_level)
                {
                    await
                    Test1.
                    setGrade_level(relatedGrade_level1);
                }
            
                const relatedGrade_level2 = await GradeLevels.findOne({
                    offset: Math.floor(Math.random() * (await GradeLevels.count())),
                });
                const Test2 = await Tests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Test2?.setGrade_level)
                {
                    await
                    Test2.
                    setGrade_level(relatedGrade_level2);
                }
            
        }
        
    
        
            
            async function associateTestWithTextbook() {
            
                const relatedTextbook0 = await Textbooks.findOne({
                    offset: Math.floor(Math.random() * (await Textbooks.count())),
                });
                const Test0 = await Tests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Test0?.setTextbook)
                {
                    await
                    Test0.
                    setTextbook(relatedTextbook0);
                }
            
                const relatedTextbook1 = await Textbooks.findOne({
                    offset: Math.floor(Math.random() * (await Textbooks.count())),
                });
                const Test1 = await Tests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Test1?.setTextbook)
                {
                    await
                    Test1.
                    setTextbook(relatedTextbook1);
                }
            
                const relatedTextbook2 = await Textbooks.findOne({
                    offset: Math.floor(Math.random() * (await Textbooks.count())),
                });
                const Test2 = await Tests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Test2?.setTextbook)
                {
                    await
                    Test2.
                    setTextbook(relatedTextbook2);
                }
            
        }
        
    
        
            
            async function associateTestWithChapter() {
            
                const relatedChapter0 = await Chapters.findOne({
                    offset: Math.floor(Math.random() * (await Chapters.count())),
                });
                const Test0 = await Tests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Test0?.setChapter)
                {
                    await
                    Test0.
                    setChapter(relatedChapter0);
                }
            
                const relatedChapter1 = await Chapters.findOne({
                    offset: Math.floor(Math.random() * (await Chapters.count())),
                });
                const Test1 = await Tests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Test1?.setChapter)
                {
                    await
                    Test1.
                    setChapter(relatedChapter1);
                }
            
                const relatedChapter2 = await Chapters.findOne({
                    offset: Math.floor(Math.random() * (await Chapters.count())),
                });
                const Test2 = await Tests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Test2?.setChapter)
                {
                    await
                    Test2.
                    setChapter(relatedChapter2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
        
            
            async function associateTestSectionWithTest() {
            
                const relatedTest0 = await Tests.findOne({
                    offset: Math.floor(Math.random() * (await Tests.count())),
                });
                const TestSection0 = await TestSections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TestSection0?.setTest)
                {
                    await
                    TestSection0.
                    setTest(relatedTest0);
                }
            
                const relatedTest1 = await Tests.findOne({
                    offset: Math.floor(Math.random() * (await Tests.count())),
                });
                const TestSection1 = await TestSections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TestSection1?.setTest)
                {
                    await
                    TestSection1.
                    setTest(relatedTest1);
                }
            
                const relatedTest2 = await Tests.findOne({
                    offset: Math.floor(Math.random() * (await Tests.count())),
                });
                const TestSection2 = await TestSections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TestSection2?.setTest)
                {
                    await
                    TestSection2.
                    setTest(relatedTest2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateTestItemWithTest() {
            
                const relatedTest0 = await Tests.findOne({
                    offset: Math.floor(Math.random() * (await Tests.count())),
                });
                const TestItem0 = await TestItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TestItem0?.setTest)
                {
                    await
                    TestItem0.
                    setTest(relatedTest0);
                }
            
                const relatedTest1 = await Tests.findOne({
                    offset: Math.floor(Math.random() * (await Tests.count())),
                });
                const TestItem1 = await TestItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TestItem1?.setTest)
                {
                    await
                    TestItem1.
                    setTest(relatedTest1);
                }
            
                const relatedTest2 = await Tests.findOne({
                    offset: Math.floor(Math.random() * (await Tests.count())),
                });
                const TestItem2 = await TestItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TestItem2?.setTest)
                {
                    await
                    TestItem2.
                    setTest(relatedTest2);
                }
            
        }
        
    
        
            
            async function associateTestItemWithSection() {
            
                const relatedSection0 = await TestSections.findOne({
                    offset: Math.floor(Math.random() * (await TestSections.count())),
                });
                const TestItem0 = await TestItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TestItem0?.setSection)
                {
                    await
                    TestItem0.
                    setSection(relatedSection0);
                }
            
                const relatedSection1 = await TestSections.findOne({
                    offset: Math.floor(Math.random() * (await TestSections.count())),
                });
                const TestItem1 = await TestItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TestItem1?.setSection)
                {
                    await
                    TestItem1.
                    setSection(relatedSection1);
                }
            
                const relatedSection2 = await TestSections.findOne({
                    offset: Math.floor(Math.random() * (await TestSections.count())),
                });
                const TestItem2 = await TestItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TestItem2?.setSection)
                {
                    await
                    TestItem2.
                    setSection(relatedSection2);
                }
            
        }
        
    
        
            
            async function associateTestItemWithQuestion() {
            
                const relatedQuestion0 = await Questions.findOne({
                    offset: Math.floor(Math.random() * (await Questions.count())),
                });
                const TestItem0 = await TestItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TestItem0?.setQuestion)
                {
                    await
                    TestItem0.
                    setQuestion(relatedQuestion0);
                }
            
                const relatedQuestion1 = await Questions.findOne({
                    offset: Math.floor(Math.random() * (await Questions.count())),
                });
                const TestItem1 = await TestItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TestItem1?.setQuestion)
                {
                    await
                    TestItem1.
                    setQuestion(relatedQuestion1);
                }
            
                const relatedQuestion2 = await Questions.findOne({
                    offset: Math.floor(Math.random() * (await Questions.count())),
                });
                const TestItem2 = await TestItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TestItem2?.setQuestion)
                {
                    await
                    TestItem2.
                    setQuestion(relatedQuestion2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateTestVersionWithTest() {
            
                const relatedTest0 = await Tests.findOne({
                    offset: Math.floor(Math.random() * (await Tests.count())),
                });
                const TestVersion0 = await TestVersions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TestVersion0?.setTest)
                {
                    await
                    TestVersion0.
                    setTest(relatedTest0);
                }
            
                const relatedTest1 = await Tests.findOne({
                    offset: Math.floor(Math.random() * (await Tests.count())),
                });
                const TestVersion1 = await TestVersions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TestVersion1?.setTest)
                {
                    await
                    TestVersion1.
                    setTest(relatedTest1);
                }
            
                const relatedTest2 = await Tests.findOne({
                    offset: Math.floor(Math.random() * (await Tests.count())),
                });
                const TestVersion2 = await TestVersions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TestVersion2?.setTest)
                {
                    await
                    TestVersion2.
                    setTest(relatedTest2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateVersionItemWithTest_version() {
            
                const relatedTest_version0 = await TestVersions.findOne({
                    offset: Math.floor(Math.random() * (await TestVersions.count())),
                });
                const VersionItem0 = await VersionItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (VersionItem0?.setTest_version)
                {
                    await
                    VersionItem0.
                    setTest_version(relatedTest_version0);
                }
            
                const relatedTest_version1 = await TestVersions.findOne({
                    offset: Math.floor(Math.random() * (await TestVersions.count())),
                });
                const VersionItem1 = await VersionItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (VersionItem1?.setTest_version)
                {
                    await
                    VersionItem1.
                    setTest_version(relatedTest_version1);
                }
            
                const relatedTest_version2 = await TestVersions.findOne({
                    offset: Math.floor(Math.random() * (await TestVersions.count())),
                });
                const VersionItem2 = await VersionItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (VersionItem2?.setTest_version)
                {
                    await
                    VersionItem2.
                    setTest_version(relatedTest_version2);
                }
            
        }
        
    
        
            
            async function associateVersionItemWithTest_item() {
            
                const relatedTest_item0 = await TestItems.findOne({
                    offset: Math.floor(Math.random() * (await TestItems.count())),
                });
                const VersionItem0 = await VersionItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (VersionItem0?.setTest_item)
                {
                    await
                    VersionItem0.
                    setTest_item(relatedTest_item0);
                }
            
                const relatedTest_item1 = await TestItems.findOne({
                    offset: Math.floor(Math.random() * (await TestItems.count())),
                });
                const VersionItem1 = await VersionItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (VersionItem1?.setTest_item)
                {
                    await
                    VersionItem1.
                    setTest_item(relatedTest_item1);
                }
            
                const relatedTest_item2 = await TestItems.findOne({
                    offset: Math.floor(Math.random() * (await TestItems.count())),
                });
                const VersionItem2 = await VersionItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (VersionItem2?.setTest_item)
                {
                    await
                    VersionItem2.
                    setTest_item(relatedTest_item2);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
            
            async function associateVersionAnswerOrderWithTest_version() {
            
                const relatedTest_version0 = await TestVersions.findOne({
                    offset: Math.floor(Math.random() * (await TestVersions.count())),
                });
                const VersionAnswerOrder0 = await VersionAnswerOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (VersionAnswerOrder0?.setTest_version)
                {
                    await
                    VersionAnswerOrder0.
                    setTest_version(relatedTest_version0);
                }
            
                const relatedTest_version1 = await TestVersions.findOne({
                    offset: Math.floor(Math.random() * (await TestVersions.count())),
                });
                const VersionAnswerOrder1 = await VersionAnswerOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (VersionAnswerOrder1?.setTest_version)
                {
                    await
                    VersionAnswerOrder1.
                    setTest_version(relatedTest_version1);
                }
            
                const relatedTest_version2 = await TestVersions.findOne({
                    offset: Math.floor(Math.random() * (await TestVersions.count())),
                });
                const VersionAnswerOrder2 = await VersionAnswerOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (VersionAnswerOrder2?.setTest_version)
                {
                    await
                    VersionAnswerOrder2.
                    setTest_version(relatedTest_version2);
                }
            
        }
        
    
        
            
            async function associateVersionAnswerOrderWithQuestion() {
            
                const relatedQuestion0 = await Questions.findOne({
                    offset: Math.floor(Math.random() * (await Questions.count())),
                });
                const VersionAnswerOrder0 = await VersionAnswerOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (VersionAnswerOrder0?.setQuestion)
                {
                    await
                    VersionAnswerOrder0.
                    setQuestion(relatedQuestion0);
                }
            
                const relatedQuestion1 = await Questions.findOne({
                    offset: Math.floor(Math.random() * (await Questions.count())),
                });
                const VersionAnswerOrder1 = await VersionAnswerOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (VersionAnswerOrder1?.setQuestion)
                {
                    await
                    VersionAnswerOrder1.
                    setQuestion(relatedQuestion1);
                }
            
                const relatedQuestion2 = await Questions.findOne({
                    offset: Math.floor(Math.random() * (await Questions.count())),
                });
                const VersionAnswerOrder2 = await VersionAnswerOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (VersionAnswerOrder2?.setQuestion)
                {
                    await
                    VersionAnswerOrder2.
                    setQuestion(relatedQuestion2);
                }
            
        }
        
    
        
    

    
    
    
        
            
            async function associateExportWithTest_version() {
            
                const relatedTest_version0 = await TestVersions.findOne({
                    offset: Math.floor(Math.random() * (await TestVersions.count())),
                });
                const Export0 = await Exports.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Export0?.setTest_version)
                {
                    await
                    Export0.
                    setTest_version(relatedTest_version0);
                }
            
                const relatedTest_version1 = await TestVersions.findOne({
                    offset: Math.floor(Math.random() * (await TestVersions.count())),
                });
                const Export1 = await Exports.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Export1?.setTest_version)
                {
                    await
                    Export1.
                    setTest_version(relatedTest_version1);
                }
            
                const relatedTest_version2 = await TestVersions.findOne({
                    offset: Math.floor(Math.random() * (await TestVersions.count())),
                });
                const Export2 = await Exports.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Export2?.setTest_version)
                {
                    await
                    Export2.
                    setTest_version(relatedTest_version2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateAnswerKeyWithTest_version() {
            
                const relatedTest_version0 = await TestVersions.findOne({
                    offset: Math.floor(Math.random() * (await TestVersions.count())),
                });
                const AnswerKey0 = await AnswerKeys.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AnswerKey0?.setTest_version)
                {
                    await
                    AnswerKey0.
                    setTest_version(relatedTest_version0);
                }
            
                const relatedTest_version1 = await TestVersions.findOne({
                    offset: Math.floor(Math.random() * (await TestVersions.count())),
                });
                const AnswerKey1 = await AnswerKeys.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AnswerKey1?.setTest_version)
                {
                    await
                    AnswerKey1.
                    setTest_version(relatedTest_version1);
                }
            
                const relatedTest_version2 = await TestVersions.findOne({
                    offset: Math.floor(Math.random() * (await TestVersions.count())),
                });
                const AnswerKey2 = await AnswerKeys.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AnswerKey2?.setTest_version)
                {
                    await
                    AnswerKey2.
                    setTest_version(relatedTest_version2);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateScoringSchemeWithTest_version() {
            
                const relatedTest_version0 = await TestVersions.findOne({
                    offset: Math.floor(Math.random() * (await TestVersions.count())),
                });
                const ScoringScheme0 = await ScoringSchemes.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ScoringScheme0?.setTest_version)
                {
                    await
                    ScoringScheme0.
                    setTest_version(relatedTest_version0);
                }
            
                const relatedTest_version1 = await TestVersions.findOne({
                    offset: Math.floor(Math.random() * (await TestVersions.count())),
                });
                const ScoringScheme1 = await ScoringSchemes.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ScoringScheme1?.setTest_version)
                {
                    await
                    ScoringScheme1.
                    setTest_version(relatedTest_version1);
                }
            
                const relatedTest_version2 = await TestVersions.findOne({
                    offset: Math.floor(Math.random() * (await TestVersions.count())),
                });
                const ScoringScheme2 = await ScoringSchemes.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ScoringScheme2?.setTest_version)
                {
                    await
                    ScoringScheme2.
                    setTest_version(relatedTest_version2);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateTestMatriceWithTest_version() {
            
                const relatedTest_version0 = await TestVersions.findOne({
                    offset: Math.floor(Math.random() * (await TestVersions.count())),
                });
                const TestMatrice0 = await TestMatrices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TestMatrice0?.setTest_version)
                {
                    await
                    TestMatrice0.
                    setTest_version(relatedTest_version0);
                }
            
                const relatedTest_version1 = await TestVersions.findOne({
                    offset: Math.floor(Math.random() * (await TestVersions.count())),
                });
                const TestMatrice1 = await TestMatrices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TestMatrice1?.setTest_version)
                {
                    await
                    TestMatrice1.
                    setTest_version(relatedTest_version1);
                }
            
                const relatedTest_version2 = await TestVersions.findOne({
                    offset: Math.floor(Math.random() * (await TestVersions.count())),
                });
                const TestMatrice2 = await TestMatrices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TestMatrice2?.setTest_version)
                {
                    await
                    TestMatrice2.
                    setTest_version(relatedTest_version2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateMatrixRowWithTest_matrix() {
            
                const relatedTest_matrix0 = await TestMatrices.findOne({
                    offset: Math.floor(Math.random() * (await TestMatrices.count())),
                });
                const MatrixRow0 = await MatrixRows.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MatrixRow0?.setTest_matrix)
                {
                    await
                    MatrixRow0.
                    setTest_matrix(relatedTest_matrix0);
                }
            
                const relatedTest_matrix1 = await TestMatrices.findOne({
                    offset: Math.floor(Math.random() * (await TestMatrices.count())),
                });
                const MatrixRow1 = await MatrixRows.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MatrixRow1?.setTest_matrix)
                {
                    await
                    MatrixRow1.
                    setTest_matrix(relatedTest_matrix1);
                }
            
                const relatedTest_matrix2 = await TestMatrices.findOne({
                    offset: Math.floor(Math.random() * (await TestMatrices.count())),
                });
                const MatrixRow2 = await MatrixRows.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MatrixRow2?.setTest_matrix)
                {
                    await
                    MatrixRow2.
                    setTest_matrix(relatedTest_matrix2);
                }
            
        }
        
    
        
            
            async function associateMatrixRowWithTest_item() {
            
                const relatedTest_item0 = await TestItems.findOne({
                    offset: Math.floor(Math.random() * (await TestItems.count())),
                });
                const MatrixRow0 = await MatrixRows.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MatrixRow0?.setTest_item)
                {
                    await
                    MatrixRow0.
                    setTest_item(relatedTest_item0);
                }
            
                const relatedTest_item1 = await TestItems.findOne({
                    offset: Math.floor(Math.random() * (await TestItems.count())),
                });
                const MatrixRow1 = await MatrixRows.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MatrixRow1?.setTest_item)
                {
                    await
                    MatrixRow1.
                    setTest_item(relatedTest_item1);
                }
            
                const relatedTest_item2 = await TestItems.findOne({
                    offset: Math.floor(Math.random() * (await TestItems.count())),
                });
                const MatrixRow2 = await MatrixRows.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MatrixRow2?.setTest_item)
                {
                    await
                    MatrixRow2.
                    setTest_item(relatedTest_item2);
                }
            
        }
        
    
        
            
            async function associateMatrixRowWithSkill() {
            
                const relatedSkill0 = await Skills.findOne({
                    offset: Math.floor(Math.random() * (await Skills.count())),
                });
                const MatrixRow0 = await MatrixRows.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MatrixRow0?.setSkill)
                {
                    await
                    MatrixRow0.
                    setSkill(relatedSkill0);
                }
            
                const relatedSkill1 = await Skills.findOne({
                    offset: Math.floor(Math.random() * (await Skills.count())),
                });
                const MatrixRow1 = await MatrixRows.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MatrixRow1?.setSkill)
                {
                    await
                    MatrixRow1.
                    setSkill(relatedSkill1);
                }
            
                const relatedSkill2 = await Skills.findOne({
                    offset: Math.floor(Math.random() * (await Skills.count())),
                });
                const MatrixRow2 = await MatrixRows.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MatrixRow2?.setSkill)
                {
                    await
                    MatrixRow2.
                    setSkill(relatedSkill2);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
            
            async function associateCollectionWithOwner_user() {
            
                const relatedOwner_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Collection0 = await Collections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Collection0?.setOwner_user)
                {
                    await
                    Collection0.
                    setOwner_user(relatedOwner_user0);
                }
            
                const relatedOwner_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Collection1 = await Collections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Collection1?.setOwner_user)
                {
                    await
                    Collection1.
                    setOwner_user(relatedOwner_user1);
                }
            
                const relatedOwner_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Collection2 = await Collections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Collection2?.setOwner_user)
                {
                    await
                    Collection2.
                    setOwner_user(relatedOwner_user2);
                }
            
        }
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
        
            
            async function associateAiGenerationJobWithOwner_user() {
            
                const relatedOwner_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AiGenerationJob0 = await AiGenerationJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiGenerationJob0?.setOwner_user)
                {
                    await
                    AiGenerationJob0.
                    setOwner_user(relatedOwner_user0);
                }
            
                const relatedOwner_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AiGenerationJob1 = await AiGenerationJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiGenerationJob1?.setOwner_user)
                {
                    await
                    AiGenerationJob1.
                    setOwner_user(relatedOwner_user1);
                }
            
                const relatedOwner_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AiGenerationJob2 = await AiGenerationJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiGenerationJob2?.setOwner_user)
                {
                    await
                    AiGenerationJob2.
                    setOwner_user(relatedOwner_user2);
                }
            
        }
        
    
        
            
            async function associateAiGenerationJobWithChapter() {
            
                const relatedChapter0 = await Chapters.findOne({
                    offset: Math.floor(Math.random() * (await Chapters.count())),
                });
                const AiGenerationJob0 = await AiGenerationJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiGenerationJob0?.setChapter)
                {
                    await
                    AiGenerationJob0.
                    setChapter(relatedChapter0);
                }
            
                const relatedChapter1 = await Chapters.findOne({
                    offset: Math.floor(Math.random() * (await Chapters.count())),
                });
                const AiGenerationJob1 = await AiGenerationJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiGenerationJob1?.setChapter)
                {
                    await
                    AiGenerationJob1.
                    setChapter(relatedChapter1);
                }
            
                const relatedChapter2 = await Chapters.findOne({
                    offset: Math.floor(Math.random() * (await Chapters.count())),
                });
                const AiGenerationJob2 = await AiGenerationJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiGenerationJob2?.setChapter)
                {
                    await
                    AiGenerationJob2.
                    setChapter(relatedChapter2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Subjects.bulkCreate(SubjectsData);
                
            
            
                
                await GradeLevels.bulkCreate(GradeLevelsData);
                
            
            
                
                await Textbooks.bulkCreate(TextbooksData);
                
            
            
                
                await Chapters.bulkCreate(ChaptersData);
                
            
            
                
                await CurriculumStandards.bulkCreate(CurriculumStandardsData);
                
            
            
                
                await Skills.bulkCreate(SkillsData);
                
            
            
                
                await QuestionBanks.bulkCreate(QuestionBanksData);
                
            
            
                
                await Questions.bulkCreate(QuestionsData);
                
            
            
                
                await AnswerChoices.bulkCreate(AnswerChoicesData);
                
            
            
                
                await Tests.bulkCreate(TestsData);
                
            
            
                
                await TestSections.bulkCreate(TestSectionsData);
                
            
            
                
                await TestItems.bulkCreate(TestItemsData);
                
            
            
                
                await TestVersions.bulkCreate(TestVersionsData);
                
            
            
                
                await VersionItems.bulkCreate(VersionItemsData);
                
            
            
                
                await VersionAnswerOrders.bulkCreate(VersionAnswerOrdersData);
                
            
            
                
                await Exports.bulkCreate(ExportsData);
                
            
            
                
                await AnswerKeys.bulkCreate(AnswerKeysData);
                
            
            
                
                await ScoringSchemes.bulkCreate(ScoringSchemesData);
                
            
            
                
                await TestMatrices.bulkCreate(TestMatricesData);
                
            
            
                
                await MatrixRows.bulkCreate(MatrixRowsData);
                
            
            
                
                await Collections.bulkCreate(CollectionsData);
                
            
            
                
                await AiGenerationJobs.bulkCreate(AiGenerationJobsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateTextbookWithSubject(),
                    
                
                    
                        
                        await associateTextbookWithGrade_level(),
                    
                
                    
                
            
                
                
                    
                        
                        await associateChapterWithTextbook(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateCurriculumStandardWithSubject(),
                    
                
                    
                        
                        await associateCurriculumStandardWithGrade_level(),
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateSkillWithStandard(),
                    
                
            
                
                
                    
                
                    
                        
                        await associateQuestionBankWithSubject(),
                    
                
                    
                        
                        await associateQuestionBankWithGrade_level(),
                    
                
                    
                        
                        await associateQuestionBankWithTextbook(),
                    
                
                    
                
                    
                        
                        await associateQuestionBankWithOwner_user(),
                    
                
                    
                
            
                
                
                    
                        
                        await associateQuestionWithQuestion_bank(),
                    
                
                    
                        
                        await associateQuestionWithChapter(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                    
                        
                        await associateAnswerChoiceWithQuestion(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateTestWithOwner_user(),
                    
                
                    
                        
                        await associateTestWithSubject(),
                    
                
                    
                        
                        await associateTestWithGrade_level(),
                    
                
                    
                        
                        await associateTestWithTextbook(),
                    
                
                    
                        
                        await associateTestWithChapter(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                    
                        
                        await associateTestSectionWithTest(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateTestItemWithTest(),
                    
                
                    
                        
                        await associateTestItemWithSection(),
                    
                
                    
                        
                        await associateTestItemWithQuestion(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateTestVersionWithTest(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateVersionItemWithTest_version(),
                    
                
                    
                        
                        await associateVersionItemWithTest_item(),
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateVersionAnswerOrderWithTest_version(),
                    
                
                    
                        
                        await associateVersionAnswerOrderWithQuestion(),
                    
                
                    
                
            
                
                
                    
                        
                        await associateExportWithTest_version(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateAnswerKeyWithTest_version(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateScoringSchemeWithTest_version(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateTestMatriceWithTest_version(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateMatrixRowWithTest_matrix(),
                    
                
                    
                        
                        await associateMatrixRowWithTest_item(),
                    
                
                    
                        
                        await associateMatrixRowWithSkill(),
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateCollectionWithOwner_user(),
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                    
                        
                        await associateAiGenerationJobWithOwner_user(),
                    
                
                    
                        
                        await associateAiGenerationJobWithChapter(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('subjects', null, {});
            
            
            await queryInterface.bulkDelete('grade_levels', null, {});
            
            
            await queryInterface.bulkDelete('textbooks', null, {});
            
            
            await queryInterface.bulkDelete('chapters', null, {});
            
            
            await queryInterface.bulkDelete('curriculum_standards', null, {});
            
            
            await queryInterface.bulkDelete('skills', null, {});
            
            
            await queryInterface.bulkDelete('question_banks', null, {});
            
            
            await queryInterface.bulkDelete('questions', null, {});
            
            
            await queryInterface.bulkDelete('answer_choices', null, {});
            
            
            await queryInterface.bulkDelete('tests', null, {});
            
            
            await queryInterface.bulkDelete('test_sections', null, {});
            
            
            await queryInterface.bulkDelete('test_items', null, {});
            
            
            await queryInterface.bulkDelete('test_versions', null, {});
            
            
            await queryInterface.bulkDelete('version_items', null, {});
            
            
            await queryInterface.bulkDelete('version_answer_orders', null, {});
            
            
            await queryInterface.bulkDelete('exports', null, {});
            
            
            await queryInterface.bulkDelete('answer_keys', null, {});
            
            
            await queryInterface.bulkDelete('scoring_schemes', null, {});
            
            
            await queryInterface.bulkDelete('test_matrices', null, {});
            
            
            await queryInterface.bulkDelete('matrix_rows', null, {});
            
            
            await queryInterface.bulkDelete('collections', null, {});
            
            
            await queryInterface.bulkDelete('ai_generation_jobs', null, {});
            
        
    },
};