





















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






const Schools = db.schools;

const Campuses = db.campuses;

const AcademicYears = db.academic_years;

const Terms = db.terms;

const GradeLevels = db.grade_levels;

const Subjects = db.subjects;

const Rooms = db.rooms;

const Students = db.students;

const Parents = db.parents;

const StudentParentLinks = db.student_parent_links;

const Teachers = db.teachers;

const Classes = db.classes;

const ClassEnrollments = db.class_enrollments;

const CourseSections = db.course_sections;

const TimetableEntries = db.timetable_entries;

const AttendanceSessions = db.attendance_sessions;

const AttendanceRecords = db.attendance_records;

const Assignments = db.assignments;

const Submissions = db.submissions;

const GradeItems = db.grade_items;

const GradeRecords = db.grade_records;

const Announcements = db.announcements;

const Messages = db.messages;

const MessageRecipients = db.message_recipients;

const Events = db.events;







const SchoolsData = [
    
    {
    
        
        
            
                "name": "Riverside Public School",
            
        
    
        
        
            
                "short_name": "RPS",
            
        
    
        
        
            
                "code": "RPS-001",
            
        
    
        
        
            
                "website": "https://riversideps.edu",
            
        
    
        
        
            
                "email": "info@riversideps.edu",
            
        
    
        
        
            
                "phone": "+1 555 0100",
            
        
    
        
        
            
                "address": "125 Riverside Ave, Brookdale",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "timezone": "America/New_York",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                "name": "Northview Academy",
            
        
    
        
        
            
                "short_name": "NVA",
            
        
    
        
        
            
                "code": "NVA-100",
            
        
    
        
        
            
                "website": "https://northviewacademy.edu",
            
        
    
        
        
            
                "email": "contact@northviewacademy.edu",
            
        
    
        
        
            
                "phone": "+1 555 0110",
            
        
    
        
        
            
                "address": "88 Northview Rd, Brookdale",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "timezone": "America/New_York",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                "name": "Lakeside Secondary School",
            
        
    
        
        
            
                "short_name": "LSS",
            
        
    
        
        
            
                "code": "LSS-210",
            
        
    
        
        
            
                "website": "https://lakesidess.edu",
            
        
    
        
        
            
                "email": "hello@lakesidess.edu",
            
        
    
        
        
            
                "phone": "+1 555 0120",
            
        
    
        
        
            
                "address": "410 Lake Shore Dr, Brookdale",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "timezone": "America/New_York",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
];



const CampusesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Riverside Main Campus",
            
        
    
        
        
            
                "code": "RPS-MAIN",
            
        
    
        
        
            
                "address": "125 Riverside Ave, Brookdale",
            
        
    
        
        
            
                "phone": "+1 555 0101",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Riverside East Campus",
            
        
    
        
        
            
                "code": "RPS-EAST",
            
        
    
        
        
            
                "address": "220 East River Rd, Brookdale",
            
        
    
        
        
            
                "phone": "+1 555 0102",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Northview Campus",
            
        
    
        
        
            
                "code": "NVA-CAMPUS",
            
        
    
        
        
            
                "address": "88 Northview Rd, Brookdale",
            
        
    
        
        
            
                "phone": "+1 555 0111",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
];



const AcademicYearsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "2025-2026",
            
        
    
        
        
            
                "start_date": new Date('2025-08-25T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2026-06-10T00:00:00Z'),
            
        
    
        
        
            
                "current": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "2024-2025",
            
        
    
        
        
            
                "start_date": new Date('2024-08-26T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2025-06-11T00:00:00Z'),
            
        
    
        
        
            
                "current": false,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "2025-2026",
            
        
    
        
        
            
                "start_date": new Date('2025-08-20T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2026-06-05T00:00:00Z'),
            
        
    
        
        
            
                "current": true,
            
        
    
    },
    
];



const TermsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Fall Term",
            
        
    
        
        
            
                "start_date": new Date('2025-08-25T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2025-12-19T00:00:00Z'),
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Spring Term",
            
        
    
        
        
            
                "start_date": new Date('2026-01-05T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2026-06-10T00:00:00Z'),
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Fall Term",
            
        
    
        
        
            
                "start_date": new Date('2024-08-26T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2024-12-20T00:00:00Z'),
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
];



const GradeLevelsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Grade 6",
            
        
    
        
        
            
                "sort_order": 6,
            
        
    
        
        
            
                "description": "Middle school entry year",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Grade 7",
            
        
    
        
        
            
                "sort_order": 7,
            
        
    
        
        
            
                "description": "Middle school second year",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Grade 8",
            
        
    
        
        
            
                "sort_order": 8,
            
        
    
        
        
            
                "description": "Middle school final year",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
];



const SubjectsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Mathematics",
            
        
    
        
        
            
                "code": "MATH",
            
        
    
        
        
            
                "description": "Core mathematics curriculum",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "English Language Arts",
            
        
    
        
        
            
                "code": "ELA",
            
        
    
        
        
            
                "description": "Reading, writing and communication",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Science",
            
        
    
        
        
            
                "code": "SCI",
            
        
    
        
        
            
                "description": "Life, earth and physical sciences",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
];



const RoomsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Room 101",
            
        
    
        
        
            
                "code": "RPS-101",
            
        
    
        
        
            
                "capacity": 28,
            
        
    
        
        
            
                "room_type": "classroom",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Room 202",
            
        
    
        
        
            
                "code": "RPS-202",
            
        
    
        
        
            
                "capacity": 30,
            
        
    
        
        
            
                "room_type": "classroom",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Science Lab A",
            
        
    
        
        
            
                "code": "RPS-LAB-A",
            
        
    
        
        
            
                "capacity": 24,
            
        
    
        
        
            
                "room_type": "other",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
];



const StudentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "student_number": "RPS-S-10001",
            
        
    
        
        
            
                "gender": "female",
            
        
    
        
        
            
                "date_of_birth": new Date('2012-03-14T00:00:00Z'),
            
        
    
        
        
            
                "medical_notes": "No known allergies",
            
        
    
        
        
            
                "enrollment_date": new Date('2023-09-05T00:00:00Z'),
            
        
    
        
        
            
                "status": "transferred",
            
        
    
        
        
            
                "notes": "Enjoys science club",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "student_number": "RPS-S-10002",
            
        
    
        
        
            
                "gender": "female",
            
        
    
        
        
            
                "date_of_birth": new Date('2011-11-02T00:00:00Z'),
            
        
    
        
        
            
                "medical_notes": "Peanut allergy",
            
        
    
        
        
            
                "enrollment_date": new Date('2022-09-06T00:00:00Z'),
            
        
    
        
        
            
                "status": "graduated",
            
        
    
        
        
            
                "notes": "Needs seating near front",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "student_number": "RPS-S-10003",
            
        
    
        
        
            
                "gender": "female",
            
        
    
        
        
            
                "date_of_birth": new Date('2012-07-22T00:00:00Z'),
            
        
    
        
        
            
                "medical_notes": "Carries inhaler for asthma",
            
        
    
        
        
            
                "enrollment_date": new Date('2023-01-10T00:00:00Z'),
            
        
    
        
        
            
                "status": "transferred",
            
        
    
        
        
            
                "notes": "Participates in band",
            
        
    
    },
    
];



const ParentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "relationship_type": "guardian",
            
        
    
        
        
            
                "occupation": "Nurse",
            
        
    
        
        
            
                "can_view_grades": true,
            
        
    
        
        
            
                "can_view_attendance": true,
            
        
    
        
        
            
                "can_message_staff": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "relationship_type": "guardian",
            
        
    
        
        
            
                "occupation": "Accountant",
            
        
    
        
        
            
                "can_view_grades": true,
            
        
    
        
        
            
                "can_view_attendance": true,
            
        
    
        
        
            
                "can_message_staff": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "relationship_type": "other",
            
        
    
        
        
            
                "occupation": "Project Manager",
            
        
    
        
        
            
                "can_view_grades": true,
            
        
    
        
        
            
                "can_view_attendance": true,
            
        
    
        
        
            
                "can_message_staff": true,
            
        
    
    },
    
];



const StudentParentLinksData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "relationship_type": "other",
            
        
    
        
        
            
                "primary_contact": true,
            
        
    
        
        
            
                "pickup_authorized": true,
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "relationship_type": "guardian",
            
        
    
        
        
            
                "primary_contact": true,
            
        
    
        
        
            
                "pickup_authorized": true,
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "relationship_type": "father",
            
        
    
        
        
            
                "primary_contact": true,
            
        
    
        
        
            
                "pickup_authorized": true,
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
];



const TeachersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "employee_number": "RPS-T-501",
            
        
    
        
        
            
                "job_title": "Math Teacher",
            
        
    
        
        
            
                "employment_type": "contract",
            
        
    
        
        
            
                "hire_date": new Date('2020-08-15T00:00:00Z'),
            
        
    
        
        
            
                "status": "on_leave",
            
        
    
        
        
            
                "bio": "Focuses on problem solving and student confidence",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "employee_number": "RPS-T-502",
            
        
    
        
        
            
                "job_title": "Science Teacher",
            
        
    
        
        
            
                "employment_type": "part_time",
            
        
    
        
        
            
                "hire_date": new Date('2019-08-12T00:00:00Z'),
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                "bio": "Hands-on labs and inquiry based learning",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "employee_number": "RPS-T-503",
            
        
    
        
        
            
                "job_title": "ELA Teacher",
            
        
    
        
        
            
                "employment_type": "part_time",
            
        
    
        
        
            
                "hire_date": new Date('2021-01-05T00:00:00Z'),
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                "bio": "Reading and writing workshops",
            
        
    
    },
    
];



const ClassesData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "name": "6A",
            
        
    
        
        
            
                "code": "RPS-6A-2526",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "capacity": 28,
            
        
    
        
        
            
                "status": "planned",
            
        
    
    },
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "name": "7B",
            
        
    
        
        
            
                "code": "RPS-7B-2526",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "capacity": 30,
            
        
    
        
        
            
                "status": "archived",
            
        
    
    },
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "name": "8C",
            
        
    
        
        
            
                "code": "RPS-8C-2526",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "capacity": 27,
            
        
    
        
        
            
                "status": "active",
            
        
    
    },
    
];



const ClassEnrollmentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "start_date": new Date('2025-08-25T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2026-06-10T00:00:00Z'),
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "notes": "Standard enrollment",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "start_date": new Date('2025-08-25T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2026-06-10T00:00:00Z'),
            
        
    
        
        
            
                "status": "withdrawn",
            
        
    
        
        
            
                "notes": "Standard enrollment",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "start_date": new Date('2025-08-25T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2026-06-10T00:00:00Z'),
            
        
    
        
        
            
                "status": "withdrawn",
            
        
    
        
        
            
                "notes": "Transferred from main campus",
            
        
    
    },
    
];



const CourseSectionsData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "name": "6A Mathematics Fall",
            
        
    
        
        
            
                "section_code": "RPS-6A-MATH-F25",
            
        
    
        
        
            
                "grading_scheme": "points",
            
        
    
        
        
            
                "pass_mark": 60.0,
            
        
    
        
        
            
                "status": "planned",
            
        
    
    },
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "name": "6A ELA Fall",
            
        
    
        
        
            
                "section_code": "RPS-6A-ELA-F25",
            
        
    
        
        
            
                "grading_scheme": "points",
            
        
    
        
        
            
                "pass_mark": 60.0,
            
        
    
        
        
            
                "status": "active",
            
        
    
    },
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "name": "7B Science Fall",
            
        
    
        
        
            
                "section_code": "RPS-7B-SCI-F25",
            
        
    
        
        
            
                "grading_scheme": "percentage",
            
        
    
        
        
            
                "pass_mark": 60.0,
            
        
    
        
        
            
                "status": "archived",
            
        
    
    },
    
];



const TimetableEntriesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "day_of_week": "tuesday",
            
        
    
        
        
            
                "start_time": new Date('2025-09-01T13:00:00Z'),
            
        
    
        
        
            
                "end_time": new Date('2025-09-01T13:50:00Z'),
            
        
    
        
        
            
                "effective_from": new Date('2025-08-25T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2025-12-19T00:00:00Z'),
            
        
    
        
        
            
                "repeat_pattern": "biweekly",
            
        
    
        
        
            
                "notes": "Bring workbook",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "day_of_week": "monday",
            
        
    
        
        
            
                "start_time": new Date('2025-09-02T13:00:00Z'),
            
        
    
        
        
            
                "end_time": new Date('2025-09-02T13:50:00Z'),
            
        
    
        
        
            
                "effective_from": new Date('2025-08-25T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2025-12-19T00:00:00Z'),
            
        
    
        
        
            
                "repeat_pattern": "once",
            
        
    
        
        
            
                "notes": "Reading circle",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "day_of_week": "sunday",
            
        
    
        
        
            
                "start_time": new Date('2025-09-03T14:00:00Z'),
            
        
    
        
        
            
                "end_time": new Date('2025-09-03T14:50:00Z'),
            
        
    
        
        
            
                "effective_from": new Date('2025-08-25T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2025-12-19T00:00:00Z'),
            
        
    
        
        
            
                "repeat_pattern": "weekly",
            
        
    
        
        
            
                "notes": "Lab safety required",
            
        
    
    },
    
];



const AttendanceSessionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "session_start": new Date('2025-09-08T13:00:00Z'),
            
        
    
        
        
            
                "session_end": new Date('2025-09-08T13:50:00Z'),
            
        
    
        
        
            
                "status": "closed",
            
        
    
        
        
            
                "notes": "Unit 1 review",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "session_start": new Date('2025-09-09T13:00:00Z'),
            
        
    
        
        
            
                "session_end": new Date('2025-09-09T13:50:00Z'),
            
        
    
        
        
            
                "status": "scheduled",
            
        
    
        
        
            
                "notes": "Reading assessment",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "session_start": new Date('2025-09-10T14:00:00Z'),
            
        
    
        
        
            
                "session_end": new Date('2025-09-10T14:50:00Z'),
            
        
    
        
        
            
                "status": "open",
            
        
    
        
        
            
                "notes": "Lab introduction",
            
        
    
    },
    
];



const AttendanceRecordsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "attendance_status": "late",
            
        
    
        
        
            
                "minutes_late": 0,
            
        
    
        
        
            
                "comment": "On time",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "attendance_status": "absent",
            
        
    
        
        
            
                "minutes_late": 7,
            
        
    
        
        
            
                "comment": "Arrived after announcements",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "attendance_status": "present",
            
        
    
        
        
            
                "minutes_late": 0,
            
        
    
        
        
            
                "comment": "Participated well",
            
        
    
    },
    
];



const AssignmentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Fractions Practice Set 1",
            
        
    
        
        
            
                "description": "Complete problems 1 through 20 from the worksheet",
            
        
    
        
        
            
                "assigned_at": new Date('2025-09-08T16:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2025-09-11T16:00:00Z'),
            
        
    
        
        
            
                "max_points": 20,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Reading Journal Entry 1",
            
        
    
        
        
            
                "description": "Write a one page response to the assigned chapter",
            
        
    
        
        
            
                "assigned_at": new Date('2025-09-09T16:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2025-09-12T16:00:00Z'),
            
        
    
        
        
            
                "max_points": 10,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "status": "published",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Lab Safety Quiz Prep",
            
        
    
        
        
            
                "description": "Review the safety rules and study the vocabulary list",
            
        
    
        
        
            
                "assigned_at": new Date('2025-09-10T16:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2025-09-15T16:00:00Z'),
            
        
    
        
        
            
                "max_points": 15,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
    },
    
];



const SubmissionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "submitted_at": new Date('2025-09-10T15:40:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "text_response": "Completed all questions and checked answers",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "score": 18.0,
            
        
    
        
        
            
                "teacher_feedback": "Good work, review questions 7 and 14",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "submitted_at": new Date('2025-09-11T16:20:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "text_response": "Finished worksheet",
            
        
    
        
        
            
                "status": "graded",
            
        
    
        
        
            
                "score": 16.0,
            
        
    
        
        
            
                "teacher_feedback": "Please submit before deadline next time",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "submitted_at": new Date('2025-09-12T14:05:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "text_response": "Reflection on main character choices and setting",
            
        
    
        
        
            
                "status": "submitted",
            
        
    
        
        
            
                "score": 9.0,
            
        
    
        
        
            
                "teacher_feedback": "Strong details and clear writing",
            
        
    
    },
    
];



const GradeItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Fractions Quiz 1",
            
        
    
        
        
            
                "category": "test",
            
        
    
        
        
            
                "weight": 0.2,
            
        
    
        
        
            
                "max_points": 20,
            
        
    
        
        
            
                "assigned_at": new Date('2025-09-11T16:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2025-09-12T16:00:00Z'),
            
        
    
        
        
            
                "published": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Journal Entry 1",
            
        
    
        
        
            
                "category": "quiz",
            
        
    
        
        
            
                "weight": 0.1,
            
        
    
        
        
            
                "max_points": 10,
            
        
    
        
        
            
                "assigned_at": new Date('2025-09-09T16:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2025-09-12T16:00:00Z'),
            
        
    
        
        
            
                "published": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Lab Safety Check",
            
        
    
        
        
            
                "category": "project",
            
        
    
        
        
            
                "weight": 0.15,
            
        
    
        
        
            
                "max_points": 15,
            
        
    
        
        
            
                "assigned_at": new Date('2025-09-10T16:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2025-09-15T16:00:00Z'),
            
        
    
        
        
            
                "published": false,
            
        
    
    },
    
];



const GradeRecordsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "score": 18.0,
            
        
    
        
        
            
                "letter_grade": "C",
            
        
    
        
        
            
                "graded_at": new Date('2025-09-13T12:00:00Z'),
            
        
    
        
        
            
                "comment": "Strong understanding",
            
        
    
        
        
            
                "published": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "score": 14.0,
            
        
    
        
        
            
                "letter_grade": "F",
            
        
    
        
        
            
                "graded_at": new Date('2025-09-13T12:05:00Z'),
            
        
    
        
        
            
                "comment": "Review reducing fractions",
            
        
    
        
        
            
                "published": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "score": 9.0,
            
        
    
        
        
            
                "letter_grade": "F",
            
        
    
        
        
            
                "graded_at": new Date('2025-09-13T13:00:00Z'),
            
        
    
        
        
            
                "comment": "Clear and thoughtful response",
            
        
    
        
        
            
                "published": true,
            
        
    
    },
    
];



const AnnouncementsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Back to School Night",
            
        
    
        
        
            
                "content": "Join us for Back to School Night in the auditorium. Teachers will share course expectations and answer questions.",
            
        
    
        
        
            
                "audience": "all",
            
        
    
        
        
            
                "priority": "normal",
            
        
    
        
        
            
                "publish_at": new Date('2025-08-28T14:00:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2025-09-06T00:00:00Z'),
            
        
    
        
        
            
                "pinned": true,
            
        
    
        
        
            
                "status": "published",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Updated Visitor Check In",
            
        
    
        
        
            
                "content": "All visitors must check in at the main office and wear a badge while on campus.",
            
        
    
        
        
            
                "audience": "teachers",
            
        
    
        
        
            
                "priority": "low",
            
        
    
        
        
            
                "publish_at": new Date('2025-09-01T12:00:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2025-12-31T00:00:00Z'),
            
        
    
        
        
            
                "pinned": true,
            
        
    
        
        
            
                "status": "scheduled",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Clubs Fair",
            
        
    
        
        
            
                "content": "The Clubs Fair will be held after school in the gym. Students can explore activities and sign up.",
            
        
    
        
        
            
                "audience": "parents",
            
        
    
        
        
            
                "priority": "high",
            
        
    
        
        
            
                "publish_at": new Date('2025-09-03T16:00:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2025-09-10T00:00:00Z'),
            
        
    
        
        
            
                "pinned": true,
            
        
    
        
        
            
                "status": "archived",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const MessagesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "subject": "Welcome to the new portal",
            
        
    
        
        
            
                "body": "We are excited to launch the School Portal. Please update your contact details and notification preferences.",
            
        
    
        
        
            
                "sent_at": new Date('2025-08-26T13:00:00Z'),
            
        
    
        
        
            
                "status": "archived",
            
        
    
        
        
            
                "important": true,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "subject": "Math supplies reminder",
            
        
    
        
        
            
                "body": "Please bring a notebook, pencil and ruler to math class. A basic calculator is optional.",
            
        
    
        
        
            
                "sent_at": new Date('2025-09-02T17:00:00Z'),
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "important": true,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "subject": "Science lab safety",
            
        
    
        
        
            
                "body": "Students must wear closed toe shoes on lab days. Please review the safety expectations together.",
            
        
    
        
        
            
                "sent_at": new Date('2025-09-03T17:15:00Z'),
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "important": true,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const MessageRecipientsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "read_at": new Date('2025-08-26T14:05:00Z'),
            
        
    
        
        
            
                "delivery_status": "delivered",
            
        
    
        
        
            
                "archived": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "read_at": new Date('2025-08-27T09:10:00Z'),
            
        
    
        
        
            
                "delivery_status": "queued",
            
        
    
        
        
            
                "archived": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "read_at": new Date('2025-09-02T18:12:00Z'),
            
        
    
        
        
            
                "delivery_status": "failed",
            
        
    
        
        
            
                "archived": false,
            
        
    
    },
    
];



const EventsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Back to School Night",
            
        
    
        
        
            
                "description": "Meet teachers and learn about the year ahead",
            
        
    
        
        
            
                "start_at": new Date('2025-09-04T22:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2025-09-05T00:00:00Z'),
            
        
    
        
        
            
                "event_type": "trip",
            
        
    
        
        
            
                "visibility": "public",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "all_day": false,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Fall Holiday",
            
        
    
        
        
            
                "description": "School closed for scheduled holiday",
            
        
    
        
        
            
                "start_at": new Date('2025-10-13T00:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2025-10-14T00:00:00Z'),
            
        
    
        
        
            
                "event_type": "holiday",
            
        
    
        
        
            
                "visibility": "public",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "all_day": true,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Clubs Fair",
            
        
    
        
        
            
                "description": "Explore clubs and activities after school",
            
        
    
        
        
            
                "start_at": new Date('2025-09-09T19:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2025-09-09T21:00:00Z'),
            
        
    
        
        
            
                "event_type": "other",
            
        
    
        
        
            
                "visibility": "students_parents",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "all_day": false,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];




    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateCampusWithSchool() {
            
                const relatedSchool0 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Campus0 = await Campuses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Campus0?.setSchool)
                {
                    await
                    Campus0.
                    setSchool(relatedSchool0);
                }
            
                const relatedSchool1 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Campus1 = await Campuses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Campus1?.setSchool)
                {
                    await
                    Campus1.
                    setSchool(relatedSchool1);
                }
            
                const relatedSchool2 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Campus2 = await Campuses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Campus2?.setSchool)
                {
                    await
                    Campus2.
                    setSchool(relatedSchool2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateAcademicYearWithSchool() {
            
                const relatedSchool0 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const AcademicYear0 = await AcademicYears.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AcademicYear0?.setSchool)
                {
                    await
                    AcademicYear0.
                    setSchool(relatedSchool0);
                }
            
                const relatedSchool1 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const AcademicYear1 = await AcademicYears.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AcademicYear1?.setSchool)
                {
                    await
                    AcademicYear1.
                    setSchool(relatedSchool1);
                }
            
                const relatedSchool2 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const AcademicYear2 = await AcademicYears.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AcademicYear2?.setSchool)
                {
                    await
                    AcademicYear2.
                    setSchool(relatedSchool2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateTermWithAcademic_year() {
            
                const relatedAcademic_year0 = await AcademicYears.findOne({
                    offset: Math.floor(Math.random() * (await AcademicYears.count())),
                });
                const Term0 = await Terms.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Term0?.setAcademic_year)
                {
                    await
                    Term0.
                    setAcademic_year(relatedAcademic_year0);
                }
            
                const relatedAcademic_year1 = await AcademicYears.findOne({
                    offset: Math.floor(Math.random() * (await AcademicYears.count())),
                });
                const Term1 = await Terms.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Term1?.setAcademic_year)
                {
                    await
                    Term1.
                    setAcademic_year(relatedAcademic_year1);
                }
            
                const relatedAcademic_year2 = await AcademicYears.findOne({
                    offset: Math.floor(Math.random() * (await AcademicYears.count())),
                });
                const Term2 = await Terms.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Term2?.setAcademic_year)
                {
                    await
                    Term2.
                    setAcademic_year(relatedAcademic_year2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateGradeLevelWithSchool() {
            
                const relatedSchool0 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const GradeLevel0 = await GradeLevels.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (GradeLevel0?.setSchool)
                {
                    await
                    GradeLevel0.
                    setSchool(relatedSchool0);
                }
            
                const relatedSchool1 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const GradeLevel1 = await GradeLevels.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (GradeLevel1?.setSchool)
                {
                    await
                    GradeLevel1.
                    setSchool(relatedSchool1);
                }
            
                const relatedSchool2 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const GradeLevel2 = await GradeLevels.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (GradeLevel2?.setSchool)
                {
                    await
                    GradeLevel2.
                    setSchool(relatedSchool2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateSubjectWithSchool() {
            
                const relatedSchool0 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Subject0 = await Subjects.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Subject0?.setSchool)
                {
                    await
                    Subject0.
                    setSchool(relatedSchool0);
                }
            
                const relatedSchool1 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Subject1 = await Subjects.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Subject1?.setSchool)
                {
                    await
                    Subject1.
                    setSchool(relatedSchool1);
                }
            
                const relatedSchool2 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Subject2 = await Subjects.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Subject2?.setSchool)
                {
                    await
                    Subject2.
                    setSchool(relatedSchool2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateRoomWithCampu() {
            
                const relatedCampu0 = await Campuses.findOne({
                    offset: Math.floor(Math.random() * (await Campuses.count())),
                });
                const Room0 = await Rooms.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Room0?.setCampu)
                {
                    await
                    Room0.
                    setCampu(relatedCampu0);
                }
            
                const relatedCampu1 = await Campuses.findOne({
                    offset: Math.floor(Math.random() * (await Campuses.count())),
                });
                const Room1 = await Rooms.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Room1?.setCampu)
                {
                    await
                    Room1.
                    setCampu(relatedCampu1);
                }
            
                const relatedCampu2 = await Campuses.findOne({
                    offset: Math.floor(Math.random() * (await Campuses.count())),
                });
                const Room2 = await Rooms.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Room2?.setCampu)
                {
                    await
                    Room2.
                    setCampu(relatedCampu2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateStudentWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Student0 = await Students.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Student0?.setUser)
                {
                    await
                    Student0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Student1 = await Students.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Student1?.setUser)
                {
                    await
                    Student1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Student2 = await Students.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Student2?.setUser)
                {
                    await
                    Student2.
                    setUser(relatedUser2);
                }
            
        }
        
    
        
            
            async function associateStudentWithSchool() {
            
                const relatedSchool0 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Student0 = await Students.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Student0?.setSchool)
                {
                    await
                    Student0.
                    setSchool(relatedSchool0);
                }
            
                const relatedSchool1 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Student1 = await Students.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Student1?.setSchool)
                {
                    await
                    Student1.
                    setSchool(relatedSchool1);
                }
            
                const relatedSchool2 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Student2 = await Students.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Student2?.setSchool)
                {
                    await
                    Student2.
                    setSchool(relatedSchool2);
                }
            
        }
        
    
        
            
            async function associateStudentWithCampu() {
            
                const relatedCampu0 = await Campuses.findOne({
                    offset: Math.floor(Math.random() * (await Campuses.count())),
                });
                const Student0 = await Students.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Student0?.setCampu)
                {
                    await
                    Student0.
                    setCampu(relatedCampu0);
                }
            
                const relatedCampu1 = await Campuses.findOne({
                    offset: Math.floor(Math.random() * (await Campuses.count())),
                });
                const Student1 = await Students.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Student1?.setCampu)
                {
                    await
                    Student1.
                    setCampu(relatedCampu1);
                }
            
                const relatedCampu2 = await Campuses.findOne({
                    offset: Math.floor(Math.random() * (await Campuses.count())),
                });
                const Student2 = await Students.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Student2?.setCampu)
                {
                    await
                    Student2.
                    setCampu(relatedCampu2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateParentWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Parent0 = await Parents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Parent0?.setUser)
                {
                    await
                    Parent0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Parent1 = await Parents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Parent1?.setUser)
                {
                    await
                    Parent1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Parent2 = await Parents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Parent2?.setUser)
                {
                    await
                    Parent2.
                    setUser(relatedUser2);
                }
            
        }
        
    
        
            
            async function associateParentWithSchool() {
            
                const relatedSchool0 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Parent0 = await Parents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Parent0?.setSchool)
                {
                    await
                    Parent0.
                    setSchool(relatedSchool0);
                }
            
                const relatedSchool1 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Parent1 = await Parents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Parent1?.setSchool)
                {
                    await
                    Parent1.
                    setSchool(relatedSchool1);
                }
            
                const relatedSchool2 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Parent2 = await Parents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Parent2?.setSchool)
                {
                    await
                    Parent2.
                    setSchool(relatedSchool2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateStudentParentLinkWithStudent() {
            
                const relatedStudent0 = await Students.findOne({
                    offset: Math.floor(Math.random() * (await Students.count())),
                });
                const StudentParentLink0 = await StudentParentLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (StudentParentLink0?.setStudent)
                {
                    await
                    StudentParentLink0.
                    setStudent(relatedStudent0);
                }
            
                const relatedStudent1 = await Students.findOne({
                    offset: Math.floor(Math.random() * (await Students.count())),
                });
                const StudentParentLink1 = await StudentParentLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (StudentParentLink1?.setStudent)
                {
                    await
                    StudentParentLink1.
                    setStudent(relatedStudent1);
                }
            
                const relatedStudent2 = await Students.findOne({
                    offset: Math.floor(Math.random() * (await Students.count())),
                });
                const StudentParentLink2 = await StudentParentLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (StudentParentLink2?.setStudent)
                {
                    await
                    StudentParentLink2.
                    setStudent(relatedStudent2);
                }
            
        }
        
    
        
            
            async function associateStudentParentLinkWithParent() {
            
                const relatedParent0 = await Parents.findOne({
                    offset: Math.floor(Math.random() * (await Parents.count())),
                });
                const StudentParentLink0 = await StudentParentLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (StudentParentLink0?.setParent)
                {
                    await
                    StudentParentLink0.
                    setParent(relatedParent0);
                }
            
                const relatedParent1 = await Parents.findOne({
                    offset: Math.floor(Math.random() * (await Parents.count())),
                });
                const StudentParentLink1 = await StudentParentLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (StudentParentLink1?.setParent)
                {
                    await
                    StudentParentLink1.
                    setParent(relatedParent1);
                }
            
                const relatedParent2 = await Parents.findOne({
                    offset: Math.floor(Math.random() * (await Parents.count())),
                });
                const StudentParentLink2 = await StudentParentLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (StudentParentLink2?.setParent)
                {
                    await
                    StudentParentLink2.
                    setParent(relatedParent2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateTeacherWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Teacher0 = await Teachers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Teacher0?.setUser)
                {
                    await
                    Teacher0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Teacher1 = await Teachers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Teacher1?.setUser)
                {
                    await
                    Teacher1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Teacher2 = await Teachers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Teacher2?.setUser)
                {
                    await
                    Teacher2.
                    setUser(relatedUser2);
                }
            
        }
        
    
        
            
            async function associateTeacherWithSchool() {
            
                const relatedSchool0 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Teacher0 = await Teachers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Teacher0?.setSchool)
                {
                    await
                    Teacher0.
                    setSchool(relatedSchool0);
                }
            
                const relatedSchool1 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Teacher1 = await Teachers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Teacher1?.setSchool)
                {
                    await
                    Teacher1.
                    setSchool(relatedSchool1);
                }
            
                const relatedSchool2 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Teacher2 = await Teachers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Teacher2?.setSchool)
                {
                    await
                    Teacher2.
                    setSchool(relatedSchool2);
                }
            
        }
        
    
        
            
            async function associateTeacherWithCampu() {
            
                const relatedCampu0 = await Campuses.findOne({
                    offset: Math.floor(Math.random() * (await Campuses.count())),
                });
                const Teacher0 = await Teachers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Teacher0?.setCampu)
                {
                    await
                    Teacher0.
                    setCampu(relatedCampu0);
                }
            
                const relatedCampu1 = await Campuses.findOne({
                    offset: Math.floor(Math.random() * (await Campuses.count())),
                });
                const Teacher1 = await Teachers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Teacher1?.setCampu)
                {
                    await
                    Teacher1.
                    setCampu(relatedCampu1);
                }
            
                const relatedCampu2 = await Campuses.findOne({
                    offset: Math.floor(Math.random() * (await Campuses.count())),
                });
                const Teacher2 = await Teachers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Teacher2?.setCampu)
                {
                    await
                    Teacher2.
                    setCampu(relatedCampu2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateClassWithSchool() {
            
                const relatedSchool0 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Class0 = await Classes.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Class0?.setSchool)
                {
                    await
                    Class0.
                    setSchool(relatedSchool0);
                }
            
                const relatedSchool1 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Class1 = await Classes.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Class1?.setSchool)
                {
                    await
                    Class1.
                    setSchool(relatedSchool1);
                }
            
                const relatedSchool2 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Class2 = await Classes.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Class2?.setSchool)
                {
                    await
                    Class2.
                    setSchool(relatedSchool2);
                }
            
        }
        
    
        
            
            async function associateClassWithCampu() {
            
                const relatedCampu0 = await Campuses.findOne({
                    offset: Math.floor(Math.random() * (await Campuses.count())),
                });
                const Class0 = await Classes.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Class0?.setCampu)
                {
                    await
                    Class0.
                    setCampu(relatedCampu0);
                }
            
                const relatedCampu1 = await Campuses.findOne({
                    offset: Math.floor(Math.random() * (await Campuses.count())),
                });
                const Class1 = await Classes.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Class1?.setCampu)
                {
                    await
                    Class1.
                    setCampu(relatedCampu1);
                }
            
                const relatedCampu2 = await Campuses.findOne({
                    offset: Math.floor(Math.random() * (await Campuses.count())),
                });
                const Class2 = await Classes.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Class2?.setCampu)
                {
                    await
                    Class2.
                    setCampu(relatedCampu2);
                }
            
        }
        
    
        
            
            async function associateClassWithAcademic_year() {
            
                const relatedAcademic_year0 = await AcademicYears.findOne({
                    offset: Math.floor(Math.random() * (await AcademicYears.count())),
                });
                const Class0 = await Classes.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Class0?.setAcademic_year)
                {
                    await
                    Class0.
                    setAcademic_year(relatedAcademic_year0);
                }
            
                const relatedAcademic_year1 = await AcademicYears.findOne({
                    offset: Math.floor(Math.random() * (await AcademicYears.count())),
                });
                const Class1 = await Classes.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Class1?.setAcademic_year)
                {
                    await
                    Class1.
                    setAcademic_year(relatedAcademic_year1);
                }
            
                const relatedAcademic_year2 = await AcademicYears.findOne({
                    offset: Math.floor(Math.random() * (await AcademicYears.count())),
                });
                const Class2 = await Classes.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Class2?.setAcademic_year)
                {
                    await
                    Class2.
                    setAcademic_year(relatedAcademic_year2);
                }
            
        }
        
    
        
            
            async function associateClassWithGrade_level() {
            
                const relatedGrade_level0 = await GradeLevels.findOne({
                    offset: Math.floor(Math.random() * (await GradeLevels.count())),
                });
                const Class0 = await Classes.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Class0?.setGrade_level)
                {
                    await
                    Class0.
                    setGrade_level(relatedGrade_level0);
                }
            
                const relatedGrade_level1 = await GradeLevels.findOne({
                    offset: Math.floor(Math.random() * (await GradeLevels.count())),
                });
                const Class1 = await Classes.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Class1?.setGrade_level)
                {
                    await
                    Class1.
                    setGrade_level(relatedGrade_level1);
                }
            
                const relatedGrade_level2 = await GradeLevels.findOne({
                    offset: Math.floor(Math.random() * (await GradeLevels.count())),
                });
                const Class2 = await Classes.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Class2?.setGrade_level)
                {
                    await
                    Class2.
                    setGrade_level(relatedGrade_level2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateClassWithHomeroom_teacher() {
            
                const relatedHomeroom_teacher0 = await Teachers.findOne({
                    offset: Math.floor(Math.random() * (await Teachers.count())),
                });
                const Class0 = await Classes.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Class0?.setHomeroom_teacher)
                {
                    await
                    Class0.
                    setHomeroom_teacher(relatedHomeroom_teacher0);
                }
            
                const relatedHomeroom_teacher1 = await Teachers.findOne({
                    offset: Math.floor(Math.random() * (await Teachers.count())),
                });
                const Class1 = await Classes.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Class1?.setHomeroom_teacher)
                {
                    await
                    Class1.
                    setHomeroom_teacher(relatedHomeroom_teacher1);
                }
            
                const relatedHomeroom_teacher2 = await Teachers.findOne({
                    offset: Math.floor(Math.random() * (await Teachers.count())),
                });
                const Class2 = await Classes.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Class2?.setHomeroom_teacher)
                {
                    await
                    Class2.
                    setHomeroom_teacher(relatedHomeroom_teacher2);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
            
            async function associateClassEnrollmentWithClas() {
            
                const relatedClas0 = await Classes.findOne({
                    offset: Math.floor(Math.random() * (await Classes.count())),
                });
                const ClassEnrollment0 = await ClassEnrollments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ClassEnrollment0?.setClas)
                {
                    await
                    ClassEnrollment0.
                    setClas(relatedClas0);
                }
            
                const relatedClas1 = await Classes.findOne({
                    offset: Math.floor(Math.random() * (await Classes.count())),
                });
                const ClassEnrollment1 = await ClassEnrollments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ClassEnrollment1?.setClas)
                {
                    await
                    ClassEnrollment1.
                    setClas(relatedClas1);
                }
            
                const relatedClas2 = await Classes.findOne({
                    offset: Math.floor(Math.random() * (await Classes.count())),
                });
                const ClassEnrollment2 = await ClassEnrollments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ClassEnrollment2?.setClas)
                {
                    await
                    ClassEnrollment2.
                    setClas(relatedClas2);
                }
            
        }
        
    
        
            
            async function associateClassEnrollmentWithStudent() {
            
                const relatedStudent0 = await Students.findOne({
                    offset: Math.floor(Math.random() * (await Students.count())),
                });
                const ClassEnrollment0 = await ClassEnrollments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ClassEnrollment0?.setStudent)
                {
                    await
                    ClassEnrollment0.
                    setStudent(relatedStudent0);
                }
            
                const relatedStudent1 = await Students.findOne({
                    offset: Math.floor(Math.random() * (await Students.count())),
                });
                const ClassEnrollment1 = await ClassEnrollments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ClassEnrollment1?.setStudent)
                {
                    await
                    ClassEnrollment1.
                    setStudent(relatedStudent1);
                }
            
                const relatedStudent2 = await Students.findOne({
                    offset: Math.floor(Math.random() * (await Students.count())),
                });
                const ClassEnrollment2 = await ClassEnrollments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ClassEnrollment2?.setStudent)
                {
                    await
                    ClassEnrollment2.
                    setStudent(relatedStudent2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateCourseSectionWithClas() {
            
                const relatedClas0 = await Classes.findOne({
                    offset: Math.floor(Math.random() * (await Classes.count())),
                });
                const CourseSection0 = await CourseSections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CourseSection0?.setClas)
                {
                    await
                    CourseSection0.
                    setClas(relatedClas0);
                }
            
                const relatedClas1 = await Classes.findOne({
                    offset: Math.floor(Math.random() * (await Classes.count())),
                });
                const CourseSection1 = await CourseSections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CourseSection1?.setClas)
                {
                    await
                    CourseSection1.
                    setClas(relatedClas1);
                }
            
                const relatedClas2 = await Classes.findOne({
                    offset: Math.floor(Math.random() * (await Classes.count())),
                });
                const CourseSection2 = await CourseSections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CourseSection2?.setClas)
                {
                    await
                    CourseSection2.
                    setClas(relatedClas2);
                }
            
        }
        
    
        
            
            async function associateCourseSectionWithSubject() {
            
                const relatedSubject0 = await Subjects.findOne({
                    offset: Math.floor(Math.random() * (await Subjects.count())),
                });
                const CourseSection0 = await CourseSections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CourseSection0?.setSubject)
                {
                    await
                    CourseSection0.
                    setSubject(relatedSubject0);
                }
            
                const relatedSubject1 = await Subjects.findOne({
                    offset: Math.floor(Math.random() * (await Subjects.count())),
                });
                const CourseSection1 = await CourseSections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CourseSection1?.setSubject)
                {
                    await
                    CourseSection1.
                    setSubject(relatedSubject1);
                }
            
                const relatedSubject2 = await Subjects.findOne({
                    offset: Math.floor(Math.random() * (await Subjects.count())),
                });
                const CourseSection2 = await CourseSections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CourseSection2?.setSubject)
                {
                    await
                    CourseSection2.
                    setSubject(relatedSubject2);
                }
            
        }
        
    
        
            
            async function associateCourseSectionWithTerm() {
            
                const relatedTerm0 = await Terms.findOne({
                    offset: Math.floor(Math.random() * (await Terms.count())),
                });
                const CourseSection0 = await CourseSections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CourseSection0?.setTerm)
                {
                    await
                    CourseSection0.
                    setTerm(relatedTerm0);
                }
            
                const relatedTerm1 = await Terms.findOne({
                    offset: Math.floor(Math.random() * (await Terms.count())),
                });
                const CourseSection1 = await CourseSections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CourseSection1?.setTerm)
                {
                    await
                    CourseSection1.
                    setTerm(relatedTerm1);
                }
            
                const relatedTerm2 = await Terms.findOne({
                    offset: Math.floor(Math.random() * (await Terms.count())),
                });
                const CourseSection2 = await CourseSections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CourseSection2?.setTerm)
                {
                    await
                    CourseSection2.
                    setTerm(relatedTerm2);
                }
            
        }
        
    
        
            
            async function associateCourseSectionWithTeacher() {
            
                const relatedTeacher0 = await Teachers.findOne({
                    offset: Math.floor(Math.random() * (await Teachers.count())),
                });
                const CourseSection0 = await CourseSections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CourseSection0?.setTeacher)
                {
                    await
                    CourseSection0.
                    setTeacher(relatedTeacher0);
                }
            
                const relatedTeacher1 = await Teachers.findOne({
                    offset: Math.floor(Math.random() * (await Teachers.count())),
                });
                const CourseSection1 = await CourseSections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CourseSection1?.setTeacher)
                {
                    await
                    CourseSection1.
                    setTeacher(relatedTeacher1);
                }
            
                const relatedTeacher2 = await Teachers.findOne({
                    offset: Math.floor(Math.random() * (await Teachers.count())),
                });
                const CourseSection2 = await CourseSections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CourseSection2?.setTeacher)
                {
                    await
                    CourseSection2.
                    setTeacher(relatedTeacher2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateTimetableEntryWithCourse_section() {
            
                const relatedCourse_section0 = await CourseSections.findOne({
                    offset: Math.floor(Math.random() * (await CourseSections.count())),
                });
                const TimetableEntry0 = await TimetableEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TimetableEntry0?.setCourse_section)
                {
                    await
                    TimetableEntry0.
                    setCourse_section(relatedCourse_section0);
                }
            
                const relatedCourse_section1 = await CourseSections.findOne({
                    offset: Math.floor(Math.random() * (await CourseSections.count())),
                });
                const TimetableEntry1 = await TimetableEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TimetableEntry1?.setCourse_section)
                {
                    await
                    TimetableEntry1.
                    setCourse_section(relatedCourse_section1);
                }
            
                const relatedCourse_section2 = await CourseSections.findOne({
                    offset: Math.floor(Math.random() * (await CourseSections.count())),
                });
                const TimetableEntry2 = await TimetableEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TimetableEntry2?.setCourse_section)
                {
                    await
                    TimetableEntry2.
                    setCourse_section(relatedCourse_section2);
                }
            
        }
        
    
        
            
            async function associateTimetableEntryWithRoom() {
            
                const relatedRoom0 = await Rooms.findOne({
                    offset: Math.floor(Math.random() * (await Rooms.count())),
                });
                const TimetableEntry0 = await TimetableEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TimetableEntry0?.setRoom)
                {
                    await
                    TimetableEntry0.
                    setRoom(relatedRoom0);
                }
            
                const relatedRoom1 = await Rooms.findOne({
                    offset: Math.floor(Math.random() * (await Rooms.count())),
                });
                const TimetableEntry1 = await TimetableEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TimetableEntry1?.setRoom)
                {
                    await
                    TimetableEntry1.
                    setRoom(relatedRoom1);
                }
            
                const relatedRoom2 = await Rooms.findOne({
                    offset: Math.floor(Math.random() * (await Rooms.count())),
                });
                const TimetableEntry2 = await TimetableEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TimetableEntry2?.setRoom)
                {
                    await
                    TimetableEntry2.
                    setRoom(relatedRoom2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateAttendanceSessionWithCourse_section() {
            
                const relatedCourse_section0 = await CourseSections.findOne({
                    offset: Math.floor(Math.random() * (await CourseSections.count())),
                });
                const AttendanceSession0 = await AttendanceSessions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AttendanceSession0?.setCourse_section)
                {
                    await
                    AttendanceSession0.
                    setCourse_section(relatedCourse_section0);
                }
            
                const relatedCourse_section1 = await CourseSections.findOne({
                    offset: Math.floor(Math.random() * (await CourseSections.count())),
                });
                const AttendanceSession1 = await AttendanceSessions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AttendanceSession1?.setCourse_section)
                {
                    await
                    AttendanceSession1.
                    setCourse_section(relatedCourse_section1);
                }
            
                const relatedCourse_section2 = await CourseSections.findOne({
                    offset: Math.floor(Math.random() * (await CourseSections.count())),
                });
                const AttendanceSession2 = await AttendanceSessions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AttendanceSession2?.setCourse_section)
                {
                    await
                    AttendanceSession2.
                    setCourse_section(relatedCourse_section2);
                }
            
        }
        
    
        
            
            async function associateAttendanceSessionWithTeacher() {
            
                const relatedTeacher0 = await Teachers.findOne({
                    offset: Math.floor(Math.random() * (await Teachers.count())),
                });
                const AttendanceSession0 = await AttendanceSessions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AttendanceSession0?.setTeacher)
                {
                    await
                    AttendanceSession0.
                    setTeacher(relatedTeacher0);
                }
            
                const relatedTeacher1 = await Teachers.findOne({
                    offset: Math.floor(Math.random() * (await Teachers.count())),
                });
                const AttendanceSession1 = await AttendanceSessions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AttendanceSession1?.setTeacher)
                {
                    await
                    AttendanceSession1.
                    setTeacher(relatedTeacher1);
                }
            
                const relatedTeacher2 = await Teachers.findOne({
                    offset: Math.floor(Math.random() * (await Teachers.count())),
                });
                const AttendanceSession2 = await AttendanceSessions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AttendanceSession2?.setTeacher)
                {
                    await
                    AttendanceSession2.
                    setTeacher(relatedTeacher2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateAttendanceRecordWithAttendance_session() {
            
                const relatedAttendance_session0 = await AttendanceSessions.findOne({
                    offset: Math.floor(Math.random() * (await AttendanceSessions.count())),
                });
                const AttendanceRecord0 = await AttendanceRecords.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AttendanceRecord0?.setAttendance_session)
                {
                    await
                    AttendanceRecord0.
                    setAttendance_session(relatedAttendance_session0);
                }
            
                const relatedAttendance_session1 = await AttendanceSessions.findOne({
                    offset: Math.floor(Math.random() * (await AttendanceSessions.count())),
                });
                const AttendanceRecord1 = await AttendanceRecords.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AttendanceRecord1?.setAttendance_session)
                {
                    await
                    AttendanceRecord1.
                    setAttendance_session(relatedAttendance_session1);
                }
            
                const relatedAttendance_session2 = await AttendanceSessions.findOne({
                    offset: Math.floor(Math.random() * (await AttendanceSessions.count())),
                });
                const AttendanceRecord2 = await AttendanceRecords.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AttendanceRecord2?.setAttendance_session)
                {
                    await
                    AttendanceRecord2.
                    setAttendance_session(relatedAttendance_session2);
                }
            
        }
        
    
        
            
            async function associateAttendanceRecordWithStudent() {
            
                const relatedStudent0 = await Students.findOne({
                    offset: Math.floor(Math.random() * (await Students.count())),
                });
                const AttendanceRecord0 = await AttendanceRecords.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AttendanceRecord0?.setStudent)
                {
                    await
                    AttendanceRecord0.
                    setStudent(relatedStudent0);
                }
            
                const relatedStudent1 = await Students.findOne({
                    offset: Math.floor(Math.random() * (await Students.count())),
                });
                const AttendanceRecord1 = await AttendanceRecords.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AttendanceRecord1?.setStudent)
                {
                    await
                    AttendanceRecord1.
                    setStudent(relatedStudent1);
                }
            
                const relatedStudent2 = await Students.findOne({
                    offset: Math.floor(Math.random() * (await Students.count())),
                });
                const AttendanceRecord2 = await AttendanceRecords.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AttendanceRecord2?.setStudent)
                {
                    await
                    AttendanceRecord2.
                    setStudent(relatedStudent2);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateAssignmentWithCourse_section() {
            
                const relatedCourse_section0 = await CourseSections.findOne({
                    offset: Math.floor(Math.random() * (await CourseSections.count())),
                });
                const Assignment0 = await Assignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Assignment0?.setCourse_section)
                {
                    await
                    Assignment0.
                    setCourse_section(relatedCourse_section0);
                }
            
                const relatedCourse_section1 = await CourseSections.findOne({
                    offset: Math.floor(Math.random() * (await CourseSections.count())),
                });
                const Assignment1 = await Assignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Assignment1?.setCourse_section)
                {
                    await
                    Assignment1.
                    setCourse_section(relatedCourse_section1);
                }
            
                const relatedCourse_section2 = await CourseSections.findOne({
                    offset: Math.floor(Math.random() * (await CourseSections.count())),
                });
                const Assignment2 = await Assignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Assignment2?.setCourse_section)
                {
                    await
                    Assignment2.
                    setCourse_section(relatedCourse_section2);
                }
            
        }
        
    
        
            
            async function associateAssignmentWithTeacher() {
            
                const relatedTeacher0 = await Teachers.findOne({
                    offset: Math.floor(Math.random() * (await Teachers.count())),
                });
                const Assignment0 = await Assignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Assignment0?.setTeacher)
                {
                    await
                    Assignment0.
                    setTeacher(relatedTeacher0);
                }
            
                const relatedTeacher1 = await Teachers.findOne({
                    offset: Math.floor(Math.random() * (await Teachers.count())),
                });
                const Assignment1 = await Assignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Assignment1?.setTeacher)
                {
                    await
                    Assignment1.
                    setTeacher(relatedTeacher1);
                }
            
                const relatedTeacher2 = await Teachers.findOne({
                    offset: Math.floor(Math.random() * (await Teachers.count())),
                });
                const Assignment2 = await Assignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Assignment2?.setTeacher)
                {
                    await
                    Assignment2.
                    setTeacher(relatedTeacher2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateSubmissionWithAssignment() {
            
                const relatedAssignment0 = await Assignments.findOne({
                    offset: Math.floor(Math.random() * (await Assignments.count())),
                });
                const Submission0 = await Submissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Submission0?.setAssignment)
                {
                    await
                    Submission0.
                    setAssignment(relatedAssignment0);
                }
            
                const relatedAssignment1 = await Assignments.findOne({
                    offset: Math.floor(Math.random() * (await Assignments.count())),
                });
                const Submission1 = await Submissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Submission1?.setAssignment)
                {
                    await
                    Submission1.
                    setAssignment(relatedAssignment1);
                }
            
                const relatedAssignment2 = await Assignments.findOne({
                    offset: Math.floor(Math.random() * (await Assignments.count())),
                });
                const Submission2 = await Submissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Submission2?.setAssignment)
                {
                    await
                    Submission2.
                    setAssignment(relatedAssignment2);
                }
            
        }
        
    
        
            
            async function associateSubmissionWithStudent() {
            
                const relatedStudent0 = await Students.findOne({
                    offset: Math.floor(Math.random() * (await Students.count())),
                });
                const Submission0 = await Submissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Submission0?.setStudent)
                {
                    await
                    Submission0.
                    setStudent(relatedStudent0);
                }
            
                const relatedStudent1 = await Students.findOne({
                    offset: Math.floor(Math.random() * (await Students.count())),
                });
                const Submission1 = await Submissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Submission1?.setStudent)
                {
                    await
                    Submission1.
                    setStudent(relatedStudent1);
                }
            
                const relatedStudent2 = await Students.findOne({
                    offset: Math.floor(Math.random() * (await Students.count())),
                });
                const Submission2 = await Submissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Submission2?.setStudent)
                {
                    await
                    Submission2.
                    setStudent(relatedStudent2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateGradeItemWithCourse_section() {
            
                const relatedCourse_section0 = await CourseSections.findOne({
                    offset: Math.floor(Math.random() * (await CourseSections.count())),
                });
                const GradeItem0 = await GradeItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (GradeItem0?.setCourse_section)
                {
                    await
                    GradeItem0.
                    setCourse_section(relatedCourse_section0);
                }
            
                const relatedCourse_section1 = await CourseSections.findOne({
                    offset: Math.floor(Math.random() * (await CourseSections.count())),
                });
                const GradeItem1 = await GradeItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (GradeItem1?.setCourse_section)
                {
                    await
                    GradeItem1.
                    setCourse_section(relatedCourse_section1);
                }
            
                const relatedCourse_section2 = await CourseSections.findOne({
                    offset: Math.floor(Math.random() * (await CourseSections.count())),
                });
                const GradeItem2 = await GradeItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (GradeItem2?.setCourse_section)
                {
                    await
                    GradeItem2.
                    setCourse_section(relatedCourse_section2);
                }
            
        }
        
    
        
            
            async function associateGradeItemWithTeacher() {
            
                const relatedTeacher0 = await Teachers.findOne({
                    offset: Math.floor(Math.random() * (await Teachers.count())),
                });
                const GradeItem0 = await GradeItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (GradeItem0?.setTeacher)
                {
                    await
                    GradeItem0.
                    setTeacher(relatedTeacher0);
                }
            
                const relatedTeacher1 = await Teachers.findOne({
                    offset: Math.floor(Math.random() * (await Teachers.count())),
                });
                const GradeItem1 = await GradeItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (GradeItem1?.setTeacher)
                {
                    await
                    GradeItem1.
                    setTeacher(relatedTeacher1);
                }
            
                const relatedTeacher2 = await Teachers.findOne({
                    offset: Math.floor(Math.random() * (await Teachers.count())),
                });
                const GradeItem2 = await GradeItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (GradeItem2?.setTeacher)
                {
                    await
                    GradeItem2.
                    setTeacher(relatedTeacher2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateGradeRecordWithGrade_item() {
            
                const relatedGrade_item0 = await GradeItems.findOne({
                    offset: Math.floor(Math.random() * (await GradeItems.count())),
                });
                const GradeRecord0 = await GradeRecords.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (GradeRecord0?.setGrade_item)
                {
                    await
                    GradeRecord0.
                    setGrade_item(relatedGrade_item0);
                }
            
                const relatedGrade_item1 = await GradeItems.findOne({
                    offset: Math.floor(Math.random() * (await GradeItems.count())),
                });
                const GradeRecord1 = await GradeRecords.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (GradeRecord1?.setGrade_item)
                {
                    await
                    GradeRecord1.
                    setGrade_item(relatedGrade_item1);
                }
            
                const relatedGrade_item2 = await GradeItems.findOne({
                    offset: Math.floor(Math.random() * (await GradeItems.count())),
                });
                const GradeRecord2 = await GradeRecords.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (GradeRecord2?.setGrade_item)
                {
                    await
                    GradeRecord2.
                    setGrade_item(relatedGrade_item2);
                }
            
        }
        
    
        
            
            async function associateGradeRecordWithStudent() {
            
                const relatedStudent0 = await Students.findOne({
                    offset: Math.floor(Math.random() * (await Students.count())),
                });
                const GradeRecord0 = await GradeRecords.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (GradeRecord0?.setStudent)
                {
                    await
                    GradeRecord0.
                    setStudent(relatedStudent0);
                }
            
                const relatedStudent1 = await Students.findOne({
                    offset: Math.floor(Math.random() * (await Students.count())),
                });
                const GradeRecord1 = await GradeRecords.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (GradeRecord1?.setStudent)
                {
                    await
                    GradeRecord1.
                    setStudent(relatedStudent1);
                }
            
                const relatedStudent2 = await Students.findOne({
                    offset: Math.floor(Math.random() * (await Students.count())),
                });
                const GradeRecord2 = await GradeRecords.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (GradeRecord2?.setStudent)
                {
                    await
                    GradeRecord2.
                    setStudent(relatedStudent2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateAnnouncementWithSchool() {
            
                const relatedSchool0 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Announcement0 = await Announcements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Announcement0?.setSchool)
                {
                    await
                    Announcement0.
                    setSchool(relatedSchool0);
                }
            
                const relatedSchool1 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Announcement1 = await Announcements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Announcement1?.setSchool)
                {
                    await
                    Announcement1.
                    setSchool(relatedSchool1);
                }
            
                const relatedSchool2 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Announcement2 = await Announcements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Announcement2?.setSchool)
                {
                    await
                    Announcement2.
                    setSchool(relatedSchool2);
                }
            
        }
        
    
        
            
            async function associateAnnouncementWithCampu() {
            
                const relatedCampu0 = await Campuses.findOne({
                    offset: Math.floor(Math.random() * (await Campuses.count())),
                });
                const Announcement0 = await Announcements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Announcement0?.setCampu)
                {
                    await
                    Announcement0.
                    setCampu(relatedCampu0);
                }
            
                const relatedCampu1 = await Campuses.findOne({
                    offset: Math.floor(Math.random() * (await Campuses.count())),
                });
                const Announcement1 = await Announcements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Announcement1?.setCampu)
                {
                    await
                    Announcement1.
                    setCampu(relatedCampu1);
                }
            
                const relatedCampu2 = await Campuses.findOne({
                    offset: Math.floor(Math.random() * (await Campuses.count())),
                });
                const Announcement2 = await Announcements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Announcement2?.setCampu)
                {
                    await
                    Announcement2.
                    setCampu(relatedCampu2);
                }
            
        }
        
    
        
            
            async function associateAnnouncementWithAuthor() {
            
                const relatedAuthor0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Announcement0 = await Announcements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Announcement0?.setAuthor)
                {
                    await
                    Announcement0.
                    setAuthor(relatedAuthor0);
                }
            
                const relatedAuthor1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Announcement1 = await Announcements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Announcement1?.setAuthor)
                {
                    await
                    Announcement1.
                    setAuthor(relatedAuthor1);
                }
            
                const relatedAuthor2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Announcement2 = await Announcements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Announcement2?.setAuthor)
                {
                    await
                    Announcement2.
                    setAuthor(relatedAuthor2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateMessageWithSender() {
            
                const relatedSender0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Message0 = await Messages.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Message0?.setSender)
                {
                    await
                    Message0.
                    setSender(relatedSender0);
                }
            
                const relatedSender1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Message1 = await Messages.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Message1?.setSender)
                {
                    await
                    Message1.
                    setSender(relatedSender1);
                }
            
                const relatedSender2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Message2 = await Messages.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Message2?.setSender)
                {
                    await
                    Message2.
                    setSender(relatedSender2);
                }
            
        }
        
    
        
            
            async function associateMessageWithSchool() {
            
                const relatedSchool0 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Message0 = await Messages.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Message0?.setSchool)
                {
                    await
                    Message0.
                    setSchool(relatedSchool0);
                }
            
                const relatedSchool1 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Message1 = await Messages.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Message1?.setSchool)
                {
                    await
                    Message1.
                    setSchool(relatedSchool1);
                }
            
                const relatedSchool2 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Message2 = await Messages.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Message2?.setSchool)
                {
                    await
                    Message2.
                    setSchool(relatedSchool2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateMessageRecipientWithMessage() {
            
                const relatedMessage0 = await Messages.findOne({
                    offset: Math.floor(Math.random() * (await Messages.count())),
                });
                const MessageRecipient0 = await MessageRecipients.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MessageRecipient0?.setMessage)
                {
                    await
                    MessageRecipient0.
                    setMessage(relatedMessage0);
                }
            
                const relatedMessage1 = await Messages.findOne({
                    offset: Math.floor(Math.random() * (await Messages.count())),
                });
                const MessageRecipient1 = await MessageRecipients.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MessageRecipient1?.setMessage)
                {
                    await
                    MessageRecipient1.
                    setMessage(relatedMessage1);
                }
            
                const relatedMessage2 = await Messages.findOne({
                    offset: Math.floor(Math.random() * (await Messages.count())),
                });
                const MessageRecipient2 = await MessageRecipients.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MessageRecipient2?.setMessage)
                {
                    await
                    MessageRecipient2.
                    setMessage(relatedMessage2);
                }
            
        }
        
    
        
            
            async function associateMessageRecipientWithRecipient() {
            
                const relatedRecipient0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MessageRecipient0 = await MessageRecipients.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MessageRecipient0?.setRecipient)
                {
                    await
                    MessageRecipient0.
                    setRecipient(relatedRecipient0);
                }
            
                const relatedRecipient1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MessageRecipient1 = await MessageRecipients.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MessageRecipient1?.setRecipient)
                {
                    await
                    MessageRecipient1.
                    setRecipient(relatedRecipient1);
                }
            
                const relatedRecipient2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MessageRecipient2 = await MessageRecipients.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MessageRecipient2?.setRecipient)
                {
                    await
                    MessageRecipient2.
                    setRecipient(relatedRecipient2);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateEventWithSchool() {
            
                const relatedSchool0 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Event0 = await Events.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Event0?.setSchool)
                {
                    await
                    Event0.
                    setSchool(relatedSchool0);
                }
            
                const relatedSchool1 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Event1 = await Events.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Event1?.setSchool)
                {
                    await
                    Event1.
                    setSchool(relatedSchool1);
                }
            
                const relatedSchool2 = await Schools.findOne({
                    offset: Math.floor(Math.random() * (await Schools.count())),
                });
                const Event2 = await Events.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Event2?.setSchool)
                {
                    await
                    Event2.
                    setSchool(relatedSchool2);
                }
            
        }
        
    
        
            
            async function associateEventWithCampu() {
            
                const relatedCampu0 = await Campuses.findOne({
                    offset: Math.floor(Math.random() * (await Campuses.count())),
                });
                const Event0 = await Events.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Event0?.setCampu)
                {
                    await
                    Event0.
                    setCampu(relatedCampu0);
                }
            
                const relatedCampu1 = await Campuses.findOne({
                    offset: Math.floor(Math.random() * (await Campuses.count())),
                });
                const Event1 = await Events.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Event1?.setCampu)
                {
                    await
                    Event1.
                    setCampu(relatedCampu1);
                }
            
                const relatedCampu2 = await Campuses.findOne({
                    offset: Math.floor(Math.random() * (await Campuses.count())),
                });
                const Event2 = await Events.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Event2?.setCampu)
                {
                    await
                    Event2.
                    setCampu(relatedCampu2);
                }
            
        }
        
    
        
            
            async function associateEventWithOrganizer() {
            
                const relatedOrganizer0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Event0 = await Events.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Event0?.setOrganizer)
                {
                    await
                    Event0.
                    setOrganizer(relatedOrganizer0);
                }
            
                const relatedOrganizer1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Event1 = await Events.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Event1?.setOrganizer)
                {
                    await
                    Event1.
                    setOrganizer(relatedOrganizer1);
                }
            
                const relatedOrganizer2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Event2 = await Events.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Event2?.setOrganizer)
                {
                    await
                    Event2.
                    setOrganizer(relatedOrganizer2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateEventWithRoom() {
            
                const relatedRoom0 = await Rooms.findOne({
                    offset: Math.floor(Math.random() * (await Rooms.count())),
                });
                const Event0 = await Events.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Event0?.setRoom)
                {
                    await
                    Event0.
                    setRoom(relatedRoom0);
                }
            
                const relatedRoom1 = await Rooms.findOne({
                    offset: Math.floor(Math.random() * (await Rooms.count())),
                });
                const Event1 = await Events.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Event1?.setRoom)
                {
                    await
                    Event1.
                    setRoom(relatedRoom1);
                }
            
                const relatedRoom2 = await Rooms.findOne({
                    offset: Math.floor(Math.random() * (await Rooms.count())),
                });
                const Event2 = await Events.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Event2?.setRoom)
                {
                    await
                    Event2.
                    setRoom(relatedRoom2);
                }
            
        }
        
    
        
    
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Schools.bulkCreate(SchoolsData);
                
            
            
                
                await Campuses.bulkCreate(CampusesData);
                
            
            
                
                await AcademicYears.bulkCreate(AcademicYearsData);
                
            
            
                
                await Terms.bulkCreate(TermsData);
                
            
            
                
                await GradeLevels.bulkCreate(GradeLevelsData);
                
            
            
                
                await Subjects.bulkCreate(SubjectsData);
                
            
            
                
                await Rooms.bulkCreate(RoomsData);
                
            
            
                
                await Students.bulkCreate(StudentsData);
                
            
            
                
                await Parents.bulkCreate(ParentsData);
                
            
            
                
                await StudentParentLinks.bulkCreate(StudentParentLinksData);
                
            
            
                
                await Teachers.bulkCreate(TeachersData);
                
            
            
                
                await Classes.bulkCreate(ClassesData);
                
            
            
                
                await ClassEnrollments.bulkCreate(ClassEnrollmentsData);
                
            
            
                
                await CourseSections.bulkCreate(CourseSectionsData);
                
            
            
                
                await TimetableEntries.bulkCreate(TimetableEntriesData);
                
            
            
                
                await AttendanceSessions.bulkCreate(AttendanceSessionsData);
                
            
            
                
                await AttendanceRecords.bulkCreate(AttendanceRecordsData);
                
            
            
                
                await Assignments.bulkCreate(AssignmentsData);
                
            
            
                
                await Submissions.bulkCreate(SubmissionsData);
                
            
            
                
                await GradeItems.bulkCreate(GradeItemsData);
                
            
            
                
                await GradeRecords.bulkCreate(GradeRecordsData);
                
            
            
                
                await Announcements.bulkCreate(AnnouncementsData);
                
            
            
                
                await Messages.bulkCreate(MessagesData);
                
            
            
                
                await MessageRecipients.bulkCreate(MessageRecipientsData);
                
            
            
                
                await Events.bulkCreate(EventsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateCampusWithSchool(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateAcademicYearWithSchool(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateTermWithAcademic_year(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateGradeLevelWithSchool(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateSubjectWithSchool(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateRoomWithCampu(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateStudentWithUser(),
                    
                
                    
                        
                        await associateStudentWithSchool(),
                    
                
                    
                        
                        await associateStudentWithCampu(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateParentWithUser(),
                    
                
                    
                        
                        await associateParentWithSchool(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateStudentParentLinkWithStudent(),
                    
                
                    
                        
                        await associateStudentParentLinkWithParent(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateTeacherWithUser(),
                    
                
                    
                        
                        await associateTeacherWithSchool(),
                    
                
                    
                        
                        await associateTeacherWithCampu(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateClassWithSchool(),
                    
                
                    
                        
                        await associateClassWithCampu(),
                    
                
                    
                        
                        await associateClassWithAcademic_year(),
                    
                
                    
                        
                        await associateClassWithGrade_level(),
                    
                
                    
                
                    
                
                    
                        
                        await associateClassWithHomeroom_teacher(),
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateClassEnrollmentWithClas(),
                    
                
                    
                        
                        await associateClassEnrollmentWithStudent(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateCourseSectionWithClas(),
                    
                
                    
                        
                        await associateCourseSectionWithSubject(),
                    
                
                    
                        
                        await associateCourseSectionWithTerm(),
                    
                
                    
                        
                        await associateCourseSectionWithTeacher(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateTimetableEntryWithCourse_section(),
                    
                
                    
                        
                        await associateTimetableEntryWithRoom(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateAttendanceSessionWithCourse_section(),
                    
                
                    
                        
                        await associateAttendanceSessionWithTeacher(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateAttendanceRecordWithAttendance_session(),
                    
                
                    
                        
                        await associateAttendanceRecordWithStudent(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateAssignmentWithCourse_section(),
                    
                
                    
                        
                        await associateAssignmentWithTeacher(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateSubmissionWithAssignment(),
                    
                
                    
                        
                        await associateSubmissionWithStudent(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateGradeItemWithCourse_section(),
                    
                
                    
                        
                        await associateGradeItemWithTeacher(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateGradeRecordWithGrade_item(),
                    
                
                    
                        
                        await associateGradeRecordWithStudent(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateAnnouncementWithSchool(),
                    
                
                    
                        
                        await associateAnnouncementWithCampu(),
                    
                
                    
                        
                        await associateAnnouncementWithAuthor(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateMessageWithSender(),
                    
                
                    
                        
                        await associateMessageWithSchool(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateMessageRecipientWithMessage(),
                    
                
                    
                        
                        await associateMessageRecipientWithRecipient(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateEventWithSchool(),
                    
                
                    
                        
                        await associateEventWithCampu(),
                    
                
                    
                        
                        await associateEventWithOrganizer(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateEventWithRoom(),
                    
                
                    
                
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('schools', null, {});
            
            
            await queryInterface.bulkDelete('campuses', null, {});
            
            
            await queryInterface.bulkDelete('academic_years', null, {});
            
            
            await queryInterface.bulkDelete('terms', null, {});
            
            
            await queryInterface.bulkDelete('grade_levels', null, {});
            
            
            await queryInterface.bulkDelete('subjects', null, {});
            
            
            await queryInterface.bulkDelete('rooms', null, {});
            
            
            await queryInterface.bulkDelete('students', null, {});
            
            
            await queryInterface.bulkDelete('parents', null, {});
            
            
            await queryInterface.bulkDelete('student_parent_links', null, {});
            
            
            await queryInterface.bulkDelete('teachers', null, {});
            
            
            await queryInterface.bulkDelete('classes', null, {});
            
            
            await queryInterface.bulkDelete('class_enrollments', null, {});
            
            
            await queryInterface.bulkDelete('course_sections', null, {});
            
            
            await queryInterface.bulkDelete('timetable_entries', null, {});
            
            
            await queryInterface.bulkDelete('attendance_sessions', null, {});
            
            
            await queryInterface.bulkDelete('attendance_records', null, {});
            
            
            await queryInterface.bulkDelete('assignments', null, {});
            
            
            await queryInterface.bulkDelete('submissions', null, {});
            
            
            await queryInterface.bulkDelete('grade_items', null, {});
            
            
            await queryInterface.bulkDelete('grade_records', null, {});
            
            
            await queryInterface.bulkDelete('announcements', null, {});
            
            
            await queryInterface.bulkDelete('messages', null, {});
            
            
            await queryInterface.bulkDelete('message_recipients', null, {});
            
            
            await queryInterface.bulkDelete('events', null, {});
            
        
    },
};