





















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






const Organizations = db.organizations;

const Workspaces = db.workspaces;

const WorkspaceMemberships = db.workspace_memberships;

const ServiceCatalogItems = db.service_catalog_items;

const Customers = db.customers;

const Properties = db.properties;

const JobTemplates = db.job_templates;

const Jobs = db.jobs;

const JobAssignments = db.job_assignments;

const Checklists = db.checklists;

const ChecklistItems = db.checklist_items;

const JobChecklistRuns = db.job_checklist_runs;

const JobChecklistRunItems = db.job_checklist_run_items;

const JobMedia = db.job_media;

const Invoices = db.invoices;

const InvoiceLineItems = db.invoice_line_items;

const Payments = db.payments;

const Estimates = db.estimates;

const EstimateLineItems = db.estimate_line_items;

const RecurringSchedules = db.recurring_schedules;

const Notifications = db.notifications;

const SupportTickets = db.support_tickets;

const Plans = db.plans;

const Subscriptions = db.subscriptions;







const OrganizationsData = [
    
    {
    
        
        
            
                "name": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Alan Turing",
            
        
    
    },
    
];



const WorkspacesData = [
    
    {
    
        
        
            
                "name": "Bright Broom Cleaning Co",
            
        
    
        
        
            
                "slug": "bright-broom",
            
        
    
        
        
            
                "status": "canceled",
            
        
    
        
        
            
                "trial_ends_at": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                "timezone": "America/Los_Angeles",
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Sparkle & Shine Services",
            
        
    
        
        
            
                "slug": "sparkle-shine",
            
        
    
        
        
            
                "status": "past_due",
            
        
    
        
        
            
                "trial_ends_at": new Date('2026-02-10T00:00:00Z'),
            
        
    
        
        
            
                "timezone": "America/Denver",
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Northside Janitorial",
            
        
    
        
        
            
                "slug": "northside-janitorial",
            
        
    
        
        
            
                "status": "past_due",
            
        
    
        
        
            
                "trial_ends_at": new Date('2026-02-10T00:00:00Z'),
            
        
    
        
        
            
                "timezone": "America/New_York",
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const WorkspaceMembershipsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "role": "staff",
            
        
    
        
        
            
                "is_invited": true,
            
        
    
        
        
            
                "invited_at": new Date('2026-01-20T10:00:00Z'),
            
        
    
        
        
            
                "joined_at": new Date('2026-01-20T10:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "role": "admin",
            
        
    
        
        
            
                "is_invited": false,
            
        
    
        
        
            
                "invited_at": new Date('2026-01-20T10:10:00Z'),
            
        
    
        
        
            
                "joined_at": new Date('2026-01-20T10:12:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "role": "admin",
            
        
    
        
        
            
                "is_invited": false,
            
        
    
        
        
            
                "invited_at": new Date('2026-01-20T10:15:00Z'),
            
        
    
        
        
            
                "joined_at": new Date('2026-01-20T10:20:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ServiceCatalogItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Standard Home Clean",
            
        
    
        
        
            
                "description": "General cleaning for living areas, kitchen, and bathrooms.",
            
        
    
        
        
            
                "pricing_model": "hourly",
            
        
    
        
        
            
                "base_price": 160.0,
            
        
    
        
        
            
                "hourly_rate": 0.0,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Deep Clean",
            
        
    
        
        
            
                "description": "Detailed top-to-bottom clean including baseboards and fixtures.",
            
        
    
        
        
            
                "pricing_model": "flat",
            
        
    
        
        
            
                "base_price": 280.0,
            
        
    
        
        
            
                "hourly_rate": 0.0,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Move Out Clean",
            
        
    
        
        
            
                "description": "Cleaning for empty homes or apartments before move-out.",
            
        
    
        
        
            
                "pricing_model": "flat",
            
        
    
        
        
            
                "base_price": 340.0,
            
        
    
        
        
            
                "hourly_rate": 0.0,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CustomersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Lakeside Property Management",
            
        
    
        
        
            
                "customer_type": "residential",
            
        
    
        
        
            
                "email": "ap@lakesidepm.example",
            
        
    
        
        
            
                "phone": "+1-510-555-0102",
            
        
    
        
        
            
                "billing_address": "1200 Marina Blvd, Oakland, CA 94607",
            
        
    
        
        
            
                "notes": "Net 15 terms preferred. Email invoices.",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Priya Desai",
            
        
    
        
        
            
                "customer_type": "residential",
            
        
    
        
        
            
                "email": "priya.desai@example.com",
            
        
    
        
        
            
                "phone": "+1-408-555-0147",
            
        
    
        
        
            
                "billing_address": "55 Willow St, San Jose, CA 95112",
            
        
    
        
        
            
                "notes": "Has a small dog. Please text on arrival.",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Hawthorne Dental",
            
        
    
        
        
            
                "customer_type": "commercial",
            
        
    
        
        
            
                "email": "office@hawthornedental.example",
            
        
    
        
        
            
                "phone": "+1-415-555-0128",
            
        
    
        
        
            
                "billing_address": "410 Market St, San Francisco, CA 94105",
            
        
    
        
        
            
                "notes": "After-hours only. Alarm code on file.",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PropertiesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Lakeside PM - Unit 14B",
            
        
    
        
        
            
                "address_line1": "1400 Bay St Apt 14B",
            
        
    
        
        
            
                "address_line2": "",
            
        
    
        
        
            
                "city": "Oakland",
            
        
    
        
        
            
                "state_region": "CA",
            
        
    
        
        
            
                "postal_code": "94607",
            
        
    
        
        
            
                "access_instructions": "Call front desk for key pickup.",
            
        
    
        
        
            
                "bedrooms": 2,
            
        
    
        
        
            
                "bathrooms": 2,
            
        
    
        
        
            
                "square_feet": 980,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Desai Residence",
            
        
    
        
        
            
                "address_line1": "55 Willow St",
            
        
    
        
        
            
                "address_line2": "",
            
        
    
        
        
            
                "city": "San Jose",
            
        
    
        
        
            
                "state_region": "CA",
            
        
    
        
        
            
                "postal_code": "95112",
            
        
    
        
        
            
                "access_instructions": "Use side gate. Key under planter as agreed.",
            
        
    
        
        
            
                "bedrooms": 3,
            
        
    
        
        
            
                "bathrooms": 2,
            
        
    
        
        
            
                "square_feet": 1450,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Hawthorne Dental Suite 300",
            
        
    
        
        
            
                "address_line1": "410 Market St Ste 300",
            
        
    
        
        
            
                "address_line2": "",
            
        
    
        
        
            
                "city": "San Francisco",
            
        
    
        
        
            
                "state_region": "CA",
            
        
    
        
        
            
                "postal_code": "94105",
            
        
    
        
        
            
                "access_instructions": "Building access via security desk after 6pm.",
            
        
    
        
        
            
                "bedrooms": 0,
            
        
    
        
        
            
                "bathrooms": 2,
            
        
    
        
        
            
                "square_feet": 2100,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const JobTemplatesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Standard Clean 2BR",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "default_price": 160.0,
            
        
    
        
        
            
                "default_duration_minutes": 120,
            
        
    
        
        
            
                "default_instructions": "Focus on kitchen surfaces and bathrooms. Vacuum and mop all floors.",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Deep Clean 3BR",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "default_price": 290.0,
            
        
    
        
        
            
                "default_duration_minutes": 210,
            
        
    
        
        
            
                "default_instructions": "Include baseboards, window sills, and detailed bathroom scrub.",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Move Out 2BR",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "default_price": 340.0,
            
        
    
        
        
            
                "default_duration_minutes": 240,
            
        
    
        
        
            
                "default_instructions": "Empty cabinets, wipe inside drawers, clean appliances exterior and interior if requested.",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const JobsData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "title": "Desai Residence - Standard Clean",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "start_at": new Date('2026-02-07T17:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-02-07T19:00:00Z'),
            
        
    
        
        
            
                "estimated_duration_minutes": 120,
            
        
    
        
        
            
                "price": 160.0,
            
        
    
        
        
            
                "instructions": "Please text on arrival. Dog may be in living room.",
            
        
    
        
        
            
                "internal_notes": "First-time visit. Bring extra microfiber cloths.",
            
        
    
        
        
            
                "requires_invoice": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Hawthorne Dental - Office Cleaning",
            
        
    
        
        
            
                "status": "no_show",
            
        
    
        
        
            
                "start_at": new Date('2026-02-08T03:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-02-08T05:00:00Z'),
            
        
    
        
        
            
                "estimated_duration_minutes": 120,
            
        
    
        
        
            
                "price": 110.0,
            
        
    
        
        
            
                "instructions": "After-hours only. Disinfect high-touch surfaces.",
            
        
    
        
        
            
                "internal_notes": "Ensure biohazard bins are not touched.",
            
        
    
        
        
            
                "requires_invoice": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Lakeside PM Unit 14B - Move Out",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "start_at": new Date('2026-02-06T18:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-02-06T22:00:00Z'),
            
        
    
        
        
            
                "estimated_duration_minutes": 240,
            
        
    
        
        
            
                "price": 340.0,
            
        
    
        
        
            
                "instructions": "Unit is empty. Focus on appliances and bathrooms.",
            
        
    
        
        
            
                "internal_notes": "Key pickup at front desk.",
            
        
    
        
        
            
                "requires_invoice": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const JobAssignmentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "assignment_role": "cleaner",
            
        
    
        
        
            
                "assigned_at": new Date('2026-02-05T20:00:00Z'),
            
        
    
        
        
            
                "is_confirmed": true,
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "assignment_role": "lead",
            
        
    
        
        
            
                "assigned_at": new Date('2026-02-05T20:05:00Z'),
            
        
    
        
        
            
                "is_confirmed": true,
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "assignment_role": "lead",
            
        
    
        
        
            
                "assigned_at": new Date('2026-02-05T20:10:00Z'),
            
        
    
        
        
            
                "is_confirmed": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ChecklistsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Standard Clean Checklist",
            
        
    
        
        
            
                "scope": "service",
            
        
    
        
        
            
                "description": "Core tasks for recurring standard cleans.",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Deep Clean Checklist",
            
        
    
        
        
            
                "scope": "property",
            
        
    
        
        
            
                "description": "Expanded tasks for detailed deep cleans.",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Move Out Checklist",
            
        
    
        
        
            
                "scope": "service",
            
        
    
        
        
            
                "description": "Tasks for empty units including cabinets and appliances.",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ChecklistItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Sanitize bathroom sink and counter",
            
        
    
        
        
            
                "details": "Use non-abrasive cleaner and wipe dry.",
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
        
        
            
                "is_required": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Clean toilet inside and out",
            
        
    
        
        
            
                "details": "Disinfect all touch points including flush handle.",
            
        
    
        
        
            
                "sort_order": 2,
            
        
    
        
        
            
                "is_required": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Vacuum carpets and rugs",
            
        
    
        
        
            
                "details": "Edge along baseboards where possible.",
            
        
    
        
        
            
                "sort_order": 3,
            
        
    
        
        
            
                "is_required": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const JobChecklistRunsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                "started_at": new Date('2026-02-06T18:10:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-02-06T22:05:00Z'),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                "started_at": new Date('2026-02-03T18:40:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-02-03T21:55:00Z'),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "started_at": new Date('2026-02-07T16:55:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-02-07T19:10:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const JobChecklistRunItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "state": "done",
            
        
    
        
        
            
                "notes": "Completed as expected",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "completed_at": new Date('2026-02-06T19:00:00Z'),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "state": "skipped",
            
        
    
        
        
            
                "notes": "Disinfected all touch points",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "completed_at": new Date('2026-02-06T19:15:00Z'),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "state": "failed",
            
        
    
        
        
            
                "notes": "Will complete after vacuuming",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "completed_at": new Date('2026-02-06T19:30:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const JobMediaData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "media_type": "before",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "caption": "Kitchen before cleaning",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "uploaded_at": new Date('2026-02-03T18:35:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "media_type": "issue",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "caption": "Kitchen after cleaning",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "uploaded_at": new Date('2026-02-03T21:58:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "media_type": "after",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "caption": "Stain on carpet near entry",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "uploaded_at": new Date('2026-02-06T19:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InvoicesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "INV-2026-0001",
            
        
    
        
        
            
                "status": "void",
            
        
    
        
        
            
                "issue_date": new Date('2026-02-03T23:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2026-02-10T23:59:00Z'),
            
        
    
        
        
            
                "subtotal": 280.0,
            
        
    
        
        
            
                "tax_amount": 0.0,
            
        
    
        
        
            
                "discount_amount": 0.0,
            
        
    
        
        
            
                "total": 280.0,
            
        
    
        
        
            
                "notes": "Thank you for your business.",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "invoice_number": "INV-2026-0002",
            
        
    
        
        
            
                "status": "paid",
            
        
    
        
        
            
                "issue_date": new Date('2026-02-06T23:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2026-02-13T23:59:00Z'),
            
        
    
        
        
            
                "subtotal": 340.0,
            
        
    
        
        
            
                "tax_amount": 0.0,
            
        
    
        
        
            
                "discount_amount": 0.0,
            
        
    
        
        
            
                "total": 340.0,
            
        
    
        
        
            
                "notes": "Move out service for Unit 14B.",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "invoice_number": "INV-2026-0003",
            
        
    
        
        
            
                "status": "partially_paid",
            
        
    
        
        
            
                "issue_date": new Date('2026-02-01T23:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2026-02-08T23:59:00Z'),
            
        
    
        
        
            
                "subtotal": 160.0,
            
        
    
        
        
            
                "tax_amount": 0.0,
            
        
    
        
        
            
                "discount_amount": 10.0,
            
        
    
        
        
            
                "total": 150.0,
            
        
    
        
        
            
                "notes": "Loyalty discount applied.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InvoiceLineItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Deep Clean Service",
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "unit_price": 280.0,
            
        
    
        
        
            
                "line_total": 280.0,
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Move Out Clean Service",
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "unit_price": 340.0,
            
        
    
        
        
            
                "line_total": 340.0,
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Standard Home Clean",
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "unit_price": 160.0,
            
        
    
        
        
            
                "line_total": 160.0,
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PaymentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "amount": 150.0,
            
        
    
        
        
            
                "method": "check",
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                "paid_at": new Date('2026-02-04T01:15:00Z'),
            
        
    
        
        
            
                "reference": "PAY-8K2F3A",
            
        
    
        
        
            
                "notes": "Paid via card on file.",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "amount": 110.0,
            
        
    
        
        
            
                "method": "cash",
            
        
    
        
        
            
                "status": "succeeded",
            
        
    
        
        
            
                "paid_at": new Date('2026-02-05T18:00:00Z'),
            
        
    
        
        
            
                "reference": "PAY-BT-22014",
            
        
    
        
        
            
                "notes": "ACH transfer received.",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "amount": 100.0,
            
        
    
        
        
            
                "method": "other",
            
        
    
        
        
            
                "status": "pending",
            
        
    
        
        
            
                "paid_at": new Date('2026-02-06T23:10:00Z'),
            
        
    
        
        
            
                "reference": "PAY-CASH-1001",
            
        
    
        
        
            
                "notes": "Partial payment collected on site.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const EstimatesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "estimate_number": "EST-2026-0101",
            
        
    
        
        
            
                "status": "declined",
            
        
    
        
        
            
                "issue_date": new Date('2026-02-01T18:00:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2026-02-15T18:00:00Z'),
            
        
    
        
        
            
                "subtotal": 320.0,
            
        
    
        
        
            
                "tax_amount": 0.0,
            
        
    
        
        
            
                "discount_amount": 0.0,
            
        
    
        
        
            
                "total": 320.0,
            
        
    
        
        
            
                "notes": "Includes standard clean plus oven add-on.",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "estimate_number": "EST-2026-0102",
            
        
    
        
        
            
                "status": "accepted",
            
        
    
        
        
            
                "issue_date": new Date('2026-01-28T18:00:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2026-02-11T18:00:00Z'),
            
        
    
        
        
            
                "subtotal": 220.0,
            
        
    
        
        
            
                "tax_amount": 0.0,
            
        
    
        
        
            
                "discount_amount": 0.0,
            
        
    
        
        
            
                "total": 220.0,
            
        
    
        
        
            
                "notes": "Monthly common area cleaning.",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "estimate_number": "EST-2026-0103",
            
        
    
        
        
            
                "status": "sent",
            
        
    
        
        
            
                "issue_date": new Date('2026-02-04T18:00:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2026-02-18T18:00:00Z'),
            
        
    
        
        
            
                "subtotal": 110.0,
            
        
    
        
        
            
                "tax_amount": 0.0,
            
        
    
        
        
            
                "discount_amount": 0.0,
            
        
    
        
        
            
                "total": 110.0,
            
        
    
        
        
            
                "notes": "After-hours office cleaning quote.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const EstimateLineItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Standard Home Clean",
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "unit_price": 160.0,
            
        
    
        
        
            
                "line_total": 160.0,
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Add-on: Inside Oven",
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "unit_price": 35.0,
            
        
    
        
        
            
                "line_total": 35.0,
            
        
    
        
        
            
                "sort_order": 2,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Deep Clean Service",
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "unit_price": 280.0,
            
        
    
        
        
            
                "line_total": 280.0,
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const RecurringSchedulesData = [
    
    {
    
        
        
            
                // 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": "Desai Biweekly Standard Clean",
            
        
    
        
        
            
                "frequency": "weekly",
            
        
    
        
        
            
                "interval_count": 2,
            
        
    
        
        
            
                "day_of_week": "tue",
            
        
    
        
        
            
                "day_of_month": 0,
            
        
    
        
        
            
                "start_at": new Date('2026-02-07T17:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-08-07T17:00:00Z'),
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "notes": "Biweekly Fridays, 2-hour slot.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Cedar Creek Monthly Common Areas",
            
        
    
        
        
            
                "frequency": "weekly",
            
        
    
        
        
            
                "interval_count": 1,
            
        
    
        
        
            
                "day_of_week": "wed",
            
        
    
        
        
            
                "day_of_month": 10,
            
        
    
        
        
            
                "start_at": new Date('2026-02-10T17:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-12-10T17:00:00Z'),
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "notes": "Target the 10th each month.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Hawthorne Dental Weekly Office Clean",
            
        
    
        
        
            
                "frequency": "biweekly",
            
        
    
        
        
            
                "interval_count": 1,
            
        
    
        
        
            
                "day_of_week": "tue",
            
        
    
        
        
            
                "day_of_month": 0,
            
        
    
        
        
            
                "start_at": new Date('2026-02-08T03:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-12-31T03:00:00Z'),
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "notes": "Sunday nights after 7pm local time.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const NotificationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "channel": "sms",
            
        
    
        
        
            
                "event_type": "payment_received",
            
        
    
        
        
            
                "subject": "New job assigned",
            
        
    
        
        
            
                "message": "You have been assigned to Desai Residence - Standard Clean.",
            
        
    
        
        
            
                "scheduled_at": new Date('2026-02-05T20:06:00Z'),
            
        
    
        
        
            
                "sent_at": new Date('2026-02-05T20:06:05Z'),
            
        
    
        
        
            
                "status": "sent",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "channel": "sms",
            
        
    
        
        
            
                "event_type": "job_assigned",
            
        
    
        
        
            
                "subject": "Job reminder",
            
        
    
        
        
            
                "message": "Reminder: Hawthorne Dental - Office Cleaning starts soon.",
            
        
    
        
        
            
                "scheduled_at": new Date('2026-02-08T02:00:00Z'),
            
        
    
        
        
            
                "sent_at": new Date('2026-02-08T02:00:10Z'),
            
        
    
        
        
            
                "status": "sent",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "channel": "email",
            
        
    
        
        
            
                "event_type": "membership_invited",
            
        
    
        
        
            
                "subject": "Invoice INV-2026-0001",
            
        
    
        
        
            
                "message": "Your invoice is ready. Please pay by the due date.",
            
        
    
        
        
            
                "scheduled_at": new Date('2026-02-03T23:05:00Z'),
            
        
    
        
        
            
                "sent_at": new Date('2026-02-03T23:05:20Z'),
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SupportTicketsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "closed",
            
        
    
        
        
            
                "priority": "urgent",
            
        
    
        
        
            
                "subject": "How to add a new staff member",
            
        
    
        
        
            
                "description": "I would like to invite a new cleaner and set their role.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "opened_at": new Date('2026-02-02T17:20:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-02-05T18:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "closed",
            
        
    
        
        
            
                "priority": "normal",
            
        
    
        
        
            
                "subject": "Invoice PDF not downloading",
            
        
    
        
        
            
                "description": "The invoice download link returns an error for INV-2026-0001.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "opened_at": new Date('2026-02-03T16:10:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-02-06T19:30:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "resolved",
            
        
    
        
        
            
                "priority": "urgent",
            
        
    
        
        
            
                "subject": "Change workspace timezone",
            
        
    
        
        
            
                "description": "Please confirm the best way to update our timezone setting.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "opened_at": new Date('2026-01-28T14:00:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-01-29T09:15:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PlansData = [
    
    {
    
        
        
            
                "name": "Starter",
            
        
    
        
        
            
                "code": "starter",
            
        
    
        
        
            
                "billing_interval": "yearly",
            
        
    
        
        
            
                "price": 49.0,
            
        
    
        
        
            
                "max_users": 3,
            
        
    
        
        
            
                "max_jobs_per_month": 60,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "description": "For small teams getting started.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Growth",
            
        
    
        
        
            
                "code": "growth",
            
        
    
        
        
            
                "billing_interval": "monthly",
            
        
    
        
        
            
                "price": 99.0,
            
        
    
        
        
            
                "max_users": 10,
            
        
    
        
        
            
                "max_jobs_per_month": 250,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "description": "For growing cleaning companies.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Pro",
            
        
    
        
        
            
                "code": "pro",
            
        
    
        
        
            
                "billing_interval": "monthly",
            
        
    
        
        
            
                "price": 179.0,
            
        
    
        
        
            
                "max_users": 25,
            
        
    
        
        
            
                "max_jobs_per_month": 1000,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "description": "For established teams with multiple crews.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SubscriptionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "canceled",
            
        
    
        
        
            
                "current_period_start": new Date('2026-02-01T00:00:00Z'),
            
        
    
        
        
            
                "current_period_end": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                "canceled_at": new Date('2026-02-15T00:00:00Z'),
            
        
    
        
        
            
                "provider": "stripe",
            
        
    
        
        
            
                "provider_subscription_ref": "sub_trial_001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "trialing",
            
        
    
        
        
            
                "current_period_start": new Date('2026-02-01T00:00:00Z'),
            
        
    
        
        
            
                "current_period_end": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                "canceled_at": new Date('2026-02-15T00:00:00Z'),
            
        
    
        
        
            
                "provider": "stripe",
            
        
    
        
        
            
                "provider_subscription_ref": "sub_active_002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "trialing",
            
        
    
        
        
            
                "current_period_start": new Date('2026-01-15T00:00:00Z'),
            
        
    
        
        
            
                "current_period_end": new Date('2026-02-15T00:00:00Z'),
            
        
    
        
        
            
                "canceled_at": new Date('2026-02-15T00:00:00Z'),
            
        
    
        
        
            
                "provider": "stripe",
            
        
    
        
        
            
                "provider_subscription_ref": "sub_pastdue_003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];




    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateUserWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User0 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (User0?.setOrganization)
                {
                    await
                    User0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User1 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (User1?.setOrganization)
                {
                    await
                    User1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User2 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (User2?.setOrganization)
                {
                    await
                    User2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
    
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateWorkspaceWithOwner() {
            
                const relatedOwner0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Workspace0 = await Workspaces.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Workspace0?.setOwner)
                {
                    await
                    Workspace0.
                    setOwner(relatedOwner0);
                }
            
                const relatedOwner1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Workspace1 = await Workspaces.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Workspace1?.setOwner)
                {
                    await
                    Workspace1.
                    setOwner(relatedOwner1);
                }
            
                const relatedOwner2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Workspace2 = await Workspaces.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Workspace2?.setOwner)
                {
                    await
                    Workspace2.
                    setOwner(relatedOwner2);
                }
            
        }
        
    
        
            
            async function associateWorkspaceWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Workspace0 = await Workspaces.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Workspace0?.setOrganization)
                {
                    await
                    Workspace0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Workspace1 = await Workspaces.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Workspace1?.setOrganization)
                {
                    await
                    Workspace1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Workspace2 = await Workspaces.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Workspace2?.setOrganization)
                {
                    await
                    Workspace2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateWorkspaceMembershipWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const WorkspaceMembership0 = await WorkspaceMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkspaceMembership0?.setWorkspace)
                {
                    await
                    WorkspaceMembership0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const WorkspaceMembership1 = await WorkspaceMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkspaceMembership1?.setWorkspace)
                {
                    await
                    WorkspaceMembership1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const WorkspaceMembership2 = await WorkspaceMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkspaceMembership2?.setWorkspace)
                {
                    await
                    WorkspaceMembership2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
            
            async function associateWorkspaceMembershipWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const WorkspaceMembership0 = await WorkspaceMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkspaceMembership0?.setUser)
                {
                    await
                    WorkspaceMembership0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const WorkspaceMembership1 = await WorkspaceMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkspaceMembership1?.setUser)
                {
                    await
                    WorkspaceMembership1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const WorkspaceMembership2 = await WorkspaceMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkspaceMembership2?.setUser)
                {
                    await
                    WorkspaceMembership2.
                    setUser(relatedUser2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateWorkspaceMembershipWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WorkspaceMembership0 = await WorkspaceMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkspaceMembership0?.setOrganization)
                {
                    await
                    WorkspaceMembership0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WorkspaceMembership1 = await WorkspaceMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkspaceMembership1?.setOrganization)
                {
                    await
                    WorkspaceMembership1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WorkspaceMembership2 = await WorkspaceMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkspaceMembership2?.setOrganization)
                {
                    await
                    WorkspaceMembership2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateServiceCatalogItemWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const ServiceCatalogItem0 = await ServiceCatalogItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ServiceCatalogItem0?.setWorkspace)
                {
                    await
                    ServiceCatalogItem0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const ServiceCatalogItem1 = await ServiceCatalogItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ServiceCatalogItem1?.setWorkspace)
                {
                    await
                    ServiceCatalogItem1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const ServiceCatalogItem2 = await ServiceCatalogItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ServiceCatalogItem2?.setWorkspace)
                {
                    await
                    ServiceCatalogItem2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateServiceCatalogItemWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ServiceCatalogItem0 = await ServiceCatalogItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ServiceCatalogItem0?.setOrganization)
                {
                    await
                    ServiceCatalogItem0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ServiceCatalogItem1 = await ServiceCatalogItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ServiceCatalogItem1?.setOrganization)
                {
                    await
                    ServiceCatalogItem1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ServiceCatalogItem2 = await ServiceCatalogItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ServiceCatalogItem2?.setOrganization)
                {
                    await
                    ServiceCatalogItem2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCustomerWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Customer0 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Customer0?.setWorkspace)
                {
                    await
                    Customer0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Customer1 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Customer1?.setWorkspace)
                {
                    await
                    Customer1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Customer2 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Customer2?.setWorkspace)
                {
                    await
                    Customer2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCustomerWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Customer0 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Customer0?.setOrganization)
                {
                    await
                    Customer0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Customer1 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Customer1?.setOrganization)
                {
                    await
                    Customer1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Customer2 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Customer2?.setOrganization)
                {
                    await
                    Customer2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associatePropertyWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Property0 = await Properties.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Property0?.setWorkspace)
                {
                    await
                    Property0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Property1 = await Properties.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Property1?.setWorkspace)
                {
                    await
                    Property1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Property2 = await Properties.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Property2?.setWorkspace)
                {
                    await
                    Property2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
            
            async function associatePropertyWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Property0 = await Properties.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Property0?.setCustomer)
                {
                    await
                    Property0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Property1 = await Properties.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Property1?.setCustomer)
                {
                    await
                    Property1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Property2 = await Properties.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Property2?.setCustomer)
                {
                    await
                    Property2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePropertyWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Property0 = await Properties.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Property0?.setOrganization)
                {
                    await
                    Property0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Property1 = await Properties.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Property1?.setOrganization)
                {
                    await
                    Property1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Property2 = await Properties.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Property2?.setOrganization)
                {
                    await
                    Property2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateJobTemplateWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const JobTemplate0 = await JobTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JobTemplate0?.setWorkspace)
                {
                    await
                    JobTemplate0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const JobTemplate1 = await JobTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JobTemplate1?.setWorkspace)
                {
                    await
                    JobTemplate1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const JobTemplate2 = await JobTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JobTemplate2?.setWorkspace)
                {
                    await
                    JobTemplate2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
    
        
            
            async function associateJobTemplateWithService_catalog_item() {
            
                const relatedService_catalog_item0 = await ServiceCatalogItems.findOne({
                    offset: Math.floor(Math.random() * (await ServiceCatalogItems.count())),
                });
                const JobTemplate0 = await JobTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JobTemplate0?.setService_catalog_item)
                {
                    await
                    JobTemplate0.
                    setService_catalog_item(relatedService_catalog_item0);
                }
            
                const relatedService_catalog_item1 = await ServiceCatalogItems.findOne({
                    offset: Math.floor(Math.random() * (await ServiceCatalogItems.count())),
                });
                const JobTemplate1 = await JobTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JobTemplate1?.setService_catalog_item)
                {
                    await
                    JobTemplate1.
                    setService_catalog_item(relatedService_catalog_item1);
                }
            
                const relatedService_catalog_item2 = await ServiceCatalogItems.findOne({
                    offset: Math.floor(Math.random() * (await ServiceCatalogItems.count())),
                });
                const JobTemplate2 = await JobTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JobTemplate2?.setService_catalog_item)
                {
                    await
                    JobTemplate2.
                    setService_catalog_item(relatedService_catalog_item2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateJobTemplateWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JobTemplate0 = await JobTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JobTemplate0?.setOrganization)
                {
                    await
                    JobTemplate0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JobTemplate1 = await JobTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JobTemplate1?.setOrganization)
                {
                    await
                    JobTemplate1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JobTemplate2 = await JobTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JobTemplate2?.setOrganization)
                {
                    await
                    JobTemplate2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateJobWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Job0 = await Jobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Job0?.setWorkspace)
                {
                    await
                    Job0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Job1 = await Jobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Job1?.setWorkspace)
                {
                    await
                    Job1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Job2 = await Jobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Job2?.setWorkspace)
                {
                    await
                    Job2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
            
            async function associateJobWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Job0 = await Jobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Job0?.setCustomer)
                {
                    await
                    Job0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Job1 = await Jobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Job1?.setCustomer)
                {
                    await
                    Job1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Job2 = await Jobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Job2?.setCustomer)
                {
                    await
                    Job2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
            
            async function associateJobWithProperty() {
            
                const relatedProperty0 = await Properties.findOne({
                    offset: Math.floor(Math.random() * (await Properties.count())),
                });
                const Job0 = await Jobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Job0?.setProperty)
                {
                    await
                    Job0.
                    setProperty(relatedProperty0);
                }
            
                const relatedProperty1 = await Properties.findOne({
                    offset: Math.floor(Math.random() * (await Properties.count())),
                });
                const Job1 = await Jobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Job1?.setProperty)
                {
                    await
                    Job1.
                    setProperty(relatedProperty1);
                }
            
                const relatedProperty2 = await Properties.findOne({
                    offset: Math.floor(Math.random() * (await Properties.count())),
                });
                const Job2 = await Jobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Job2?.setProperty)
                {
                    await
                    Job2.
                    setProperty(relatedProperty2);
                }
            
        }
        
    
        
            
            async function associateJobWithService_catalog_item() {
            
                const relatedService_catalog_item0 = await ServiceCatalogItems.findOne({
                    offset: Math.floor(Math.random() * (await ServiceCatalogItems.count())),
                });
                const Job0 = await Jobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Job0?.setService_catalog_item)
                {
                    await
                    Job0.
                    setService_catalog_item(relatedService_catalog_item0);
                }
            
                const relatedService_catalog_item1 = await ServiceCatalogItems.findOne({
                    offset: Math.floor(Math.random() * (await ServiceCatalogItems.count())),
                });
                const Job1 = await Jobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Job1?.setService_catalog_item)
                {
                    await
                    Job1.
                    setService_catalog_item(relatedService_catalog_item1);
                }
            
                const relatedService_catalog_item2 = await ServiceCatalogItems.findOne({
                    offset: Math.floor(Math.random() * (await ServiceCatalogItems.count())),
                });
                const Job2 = await Jobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Job2?.setService_catalog_item)
                {
                    await
                    Job2.
                    setService_catalog_item(relatedService_catalog_item2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateJobWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Job0 = await Jobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Job0?.setOrganization)
                {
                    await
                    Job0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Job1 = await Jobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Job1?.setOrganization)
                {
                    await
                    Job1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Job2 = await Jobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Job2?.setOrganization)
                {
                    await
                    Job2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateJobAssignmentWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const JobAssignment0 = await JobAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JobAssignment0?.setWorkspace)
                {
                    await
                    JobAssignment0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const JobAssignment1 = await JobAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JobAssignment1?.setWorkspace)
                {
                    await
                    JobAssignment1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const JobAssignment2 = await JobAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JobAssignment2?.setWorkspace)
                {
                    await
                    JobAssignment2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
            
            async function associateJobAssignmentWithJob() {
            
                const relatedJob0 = await Jobs.findOne({
                    offset: Math.floor(Math.random() * (await Jobs.count())),
                });
                const JobAssignment0 = await JobAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JobAssignment0?.setJob)
                {
                    await
                    JobAssignment0.
                    setJob(relatedJob0);
                }
            
                const relatedJob1 = await Jobs.findOne({
                    offset: Math.floor(Math.random() * (await Jobs.count())),
                });
                const JobAssignment1 = await JobAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JobAssignment1?.setJob)
                {
                    await
                    JobAssignment1.
                    setJob(relatedJob1);
                }
            
                const relatedJob2 = await Jobs.findOne({
                    offset: Math.floor(Math.random() * (await Jobs.count())),
                });
                const JobAssignment2 = await JobAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JobAssignment2?.setJob)
                {
                    await
                    JobAssignment2.
                    setJob(relatedJob2);
                }
            
        }
        
    
        
            
            async function associateJobAssignmentWithAssignee() {
            
                const relatedAssignee0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const JobAssignment0 = await JobAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JobAssignment0?.setAssignee)
                {
                    await
                    JobAssignment0.
                    setAssignee(relatedAssignee0);
                }
            
                const relatedAssignee1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const JobAssignment1 = await JobAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JobAssignment1?.setAssignee)
                {
                    await
                    JobAssignment1.
                    setAssignee(relatedAssignee1);
                }
            
                const relatedAssignee2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const JobAssignment2 = await JobAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JobAssignment2?.setAssignee)
                {
                    await
                    JobAssignment2.
                    setAssignee(relatedAssignee2);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateJobAssignmentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JobAssignment0 = await JobAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JobAssignment0?.setOrganization)
                {
                    await
                    JobAssignment0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JobAssignment1 = await JobAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JobAssignment1?.setOrganization)
                {
                    await
                    JobAssignment1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JobAssignment2 = await JobAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JobAssignment2?.setOrganization)
                {
                    await
                    JobAssignment2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateChecklistWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Checklist0 = await Checklists.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Checklist0?.setWorkspace)
                {
                    await
                    Checklist0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Checklist1 = await Checklists.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Checklist1?.setWorkspace)
                {
                    await
                    Checklist1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Checklist2 = await Checklists.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Checklist2?.setWorkspace)
                {
                    await
                    Checklist2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateChecklistWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Checklist0 = await Checklists.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Checklist0?.setOrganization)
                {
                    await
                    Checklist0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Checklist1 = await Checklists.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Checklist1?.setOrganization)
                {
                    await
                    Checklist1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Checklist2 = await Checklists.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Checklist2?.setOrganization)
                {
                    await
                    Checklist2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateChecklistItemWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const ChecklistItem0 = await ChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ChecklistItem0?.setWorkspace)
                {
                    await
                    ChecklistItem0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const ChecklistItem1 = await ChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ChecklistItem1?.setWorkspace)
                {
                    await
                    ChecklistItem1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const ChecklistItem2 = await ChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ChecklistItem2?.setWorkspace)
                {
                    await
                    ChecklistItem2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
            
            async function associateChecklistItemWithChecklist() {
            
                const relatedChecklist0 = await Checklists.findOne({
                    offset: Math.floor(Math.random() * (await Checklists.count())),
                });
                const ChecklistItem0 = await ChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ChecklistItem0?.setChecklist)
                {
                    await
                    ChecklistItem0.
                    setChecklist(relatedChecklist0);
                }
            
                const relatedChecklist1 = await Checklists.findOne({
                    offset: Math.floor(Math.random() * (await Checklists.count())),
                });
                const ChecklistItem1 = await ChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ChecklistItem1?.setChecklist)
                {
                    await
                    ChecklistItem1.
                    setChecklist(relatedChecklist1);
                }
            
                const relatedChecklist2 = await Checklists.findOne({
                    offset: Math.floor(Math.random() * (await Checklists.count())),
                });
                const ChecklistItem2 = await ChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ChecklistItem2?.setChecklist)
                {
                    await
                    ChecklistItem2.
                    setChecklist(relatedChecklist2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateChecklistItemWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ChecklistItem0 = await ChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ChecklistItem0?.setOrganization)
                {
                    await
                    ChecklistItem0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ChecklistItem1 = await ChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ChecklistItem1?.setOrganization)
                {
                    await
                    ChecklistItem1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ChecklistItem2 = await ChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ChecklistItem2?.setOrganization)
                {
                    await
                    ChecklistItem2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateJobChecklistRunWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const JobChecklistRun0 = await JobChecklistRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JobChecklistRun0?.setWorkspace)
                {
                    await
                    JobChecklistRun0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const JobChecklistRun1 = await JobChecklistRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JobChecklistRun1?.setWorkspace)
                {
                    await
                    JobChecklistRun1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const JobChecklistRun2 = await JobChecklistRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JobChecklistRun2?.setWorkspace)
                {
                    await
                    JobChecklistRun2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
            
            async function associateJobChecklistRunWithJob() {
            
                const relatedJob0 = await Jobs.findOne({
                    offset: Math.floor(Math.random() * (await Jobs.count())),
                });
                const JobChecklistRun0 = await JobChecklistRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JobChecklistRun0?.setJob)
                {
                    await
                    JobChecklistRun0.
                    setJob(relatedJob0);
                }
            
                const relatedJob1 = await Jobs.findOne({
                    offset: Math.floor(Math.random() * (await Jobs.count())),
                });
                const JobChecklistRun1 = await JobChecklistRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JobChecklistRun1?.setJob)
                {
                    await
                    JobChecklistRun1.
                    setJob(relatedJob1);
                }
            
                const relatedJob2 = await Jobs.findOne({
                    offset: Math.floor(Math.random() * (await Jobs.count())),
                });
                const JobChecklistRun2 = await JobChecklistRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JobChecklistRun2?.setJob)
                {
                    await
                    JobChecklistRun2.
                    setJob(relatedJob2);
                }
            
        }
        
    
        
            
            async function associateJobChecklistRunWithChecklist() {
            
                const relatedChecklist0 = await Checklists.findOne({
                    offset: Math.floor(Math.random() * (await Checklists.count())),
                });
                const JobChecklistRun0 = await JobChecklistRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JobChecklistRun0?.setChecklist)
                {
                    await
                    JobChecklistRun0.
                    setChecklist(relatedChecklist0);
                }
            
                const relatedChecklist1 = await Checklists.findOne({
                    offset: Math.floor(Math.random() * (await Checklists.count())),
                });
                const JobChecklistRun1 = await JobChecklistRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JobChecklistRun1?.setChecklist)
                {
                    await
                    JobChecklistRun1.
                    setChecklist(relatedChecklist1);
                }
            
                const relatedChecklist2 = await Checklists.findOne({
                    offset: Math.floor(Math.random() * (await Checklists.count())),
                });
                const JobChecklistRun2 = await JobChecklistRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JobChecklistRun2?.setChecklist)
                {
                    await
                    JobChecklistRun2.
                    setChecklist(relatedChecklist2);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateJobChecklistRunWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JobChecklistRun0 = await JobChecklistRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JobChecklistRun0?.setOrganization)
                {
                    await
                    JobChecklistRun0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JobChecklistRun1 = await JobChecklistRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JobChecklistRun1?.setOrganization)
                {
                    await
                    JobChecklistRun1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JobChecklistRun2 = await JobChecklistRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JobChecklistRun2?.setOrganization)
                {
                    await
                    JobChecklistRun2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateJobChecklistRunItemWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const JobChecklistRunItem0 = await JobChecklistRunItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JobChecklistRunItem0?.setWorkspace)
                {
                    await
                    JobChecklistRunItem0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const JobChecklistRunItem1 = await JobChecklistRunItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JobChecklistRunItem1?.setWorkspace)
                {
                    await
                    JobChecklistRunItem1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const JobChecklistRunItem2 = await JobChecklistRunItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JobChecklistRunItem2?.setWorkspace)
                {
                    await
                    JobChecklistRunItem2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
            
            async function associateJobChecklistRunItemWithJob_checklist_run() {
            
                const relatedJob_checklist_run0 = await JobChecklistRuns.findOne({
                    offset: Math.floor(Math.random() * (await JobChecklistRuns.count())),
                });
                const JobChecklistRunItem0 = await JobChecklistRunItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JobChecklistRunItem0?.setJob_checklist_run)
                {
                    await
                    JobChecklistRunItem0.
                    setJob_checklist_run(relatedJob_checklist_run0);
                }
            
                const relatedJob_checklist_run1 = await JobChecklistRuns.findOne({
                    offset: Math.floor(Math.random() * (await JobChecklistRuns.count())),
                });
                const JobChecklistRunItem1 = await JobChecklistRunItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JobChecklistRunItem1?.setJob_checklist_run)
                {
                    await
                    JobChecklistRunItem1.
                    setJob_checklist_run(relatedJob_checklist_run1);
                }
            
                const relatedJob_checklist_run2 = await JobChecklistRuns.findOne({
                    offset: Math.floor(Math.random() * (await JobChecklistRuns.count())),
                });
                const JobChecklistRunItem2 = await JobChecklistRunItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JobChecklistRunItem2?.setJob_checklist_run)
                {
                    await
                    JobChecklistRunItem2.
                    setJob_checklist_run(relatedJob_checklist_run2);
                }
            
        }
        
    
        
            
            async function associateJobChecklistRunItemWithChecklist_item() {
            
                const relatedChecklist_item0 = await ChecklistItems.findOne({
                    offset: Math.floor(Math.random() * (await ChecklistItems.count())),
                });
                const JobChecklistRunItem0 = await JobChecklistRunItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JobChecklistRunItem0?.setChecklist_item)
                {
                    await
                    JobChecklistRunItem0.
                    setChecklist_item(relatedChecklist_item0);
                }
            
                const relatedChecklist_item1 = await ChecklistItems.findOne({
                    offset: Math.floor(Math.random() * (await ChecklistItems.count())),
                });
                const JobChecklistRunItem1 = await JobChecklistRunItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JobChecklistRunItem1?.setChecklist_item)
                {
                    await
                    JobChecklistRunItem1.
                    setChecklist_item(relatedChecklist_item1);
                }
            
                const relatedChecklist_item2 = await ChecklistItems.findOne({
                    offset: Math.floor(Math.random() * (await ChecklistItems.count())),
                });
                const JobChecklistRunItem2 = await JobChecklistRunItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JobChecklistRunItem2?.setChecklist_item)
                {
                    await
                    JobChecklistRunItem2.
                    setChecklist_item(relatedChecklist_item2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateJobChecklistRunItemWithCompleted_by() {
            
                const relatedCompleted_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const JobChecklistRunItem0 = await JobChecklistRunItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JobChecklistRunItem0?.setCompleted_by)
                {
                    await
                    JobChecklistRunItem0.
                    setCompleted_by(relatedCompleted_by0);
                }
            
                const relatedCompleted_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const JobChecklistRunItem1 = await JobChecklistRunItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JobChecklistRunItem1?.setCompleted_by)
                {
                    await
                    JobChecklistRunItem1.
                    setCompleted_by(relatedCompleted_by1);
                }
            
                const relatedCompleted_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const JobChecklistRunItem2 = await JobChecklistRunItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JobChecklistRunItem2?.setCompleted_by)
                {
                    await
                    JobChecklistRunItem2.
                    setCompleted_by(relatedCompleted_by2);
                }
            
        }
        
    
        
    
        
            
            async function associateJobChecklistRunItemWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JobChecklistRunItem0 = await JobChecklistRunItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JobChecklistRunItem0?.setOrganization)
                {
                    await
                    JobChecklistRunItem0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JobChecklistRunItem1 = await JobChecklistRunItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JobChecklistRunItem1?.setOrganization)
                {
                    await
                    JobChecklistRunItem1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JobChecklistRunItem2 = await JobChecklistRunItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JobChecklistRunItem2?.setOrganization)
                {
                    await
                    JobChecklistRunItem2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateJobMediaWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const JobMedia0 = await JobMedia.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JobMedia0?.setWorkspace)
                {
                    await
                    JobMedia0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const JobMedia1 = await JobMedia.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JobMedia1?.setWorkspace)
                {
                    await
                    JobMedia1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const JobMedia2 = await JobMedia.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JobMedia2?.setWorkspace)
                {
                    await
                    JobMedia2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
            
            async function associateJobMediaWithJob() {
            
                const relatedJob0 = await Jobs.findOne({
                    offset: Math.floor(Math.random() * (await Jobs.count())),
                });
                const JobMedia0 = await JobMedia.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JobMedia0?.setJob)
                {
                    await
                    JobMedia0.
                    setJob(relatedJob0);
                }
            
                const relatedJob1 = await Jobs.findOne({
                    offset: Math.floor(Math.random() * (await Jobs.count())),
                });
                const JobMedia1 = await JobMedia.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JobMedia1?.setJob)
                {
                    await
                    JobMedia1.
                    setJob(relatedJob1);
                }
            
                const relatedJob2 = await Jobs.findOne({
                    offset: Math.floor(Math.random() * (await Jobs.count())),
                });
                const JobMedia2 = await JobMedia.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JobMedia2?.setJob)
                {
                    await
                    JobMedia2.
                    setJob(relatedJob2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateJobMediaWithUploaded_by() {
            
                const relatedUploaded_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const JobMedia0 = await JobMedia.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JobMedia0?.setUploaded_by)
                {
                    await
                    JobMedia0.
                    setUploaded_by(relatedUploaded_by0);
                }
            
                const relatedUploaded_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const JobMedia1 = await JobMedia.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JobMedia1?.setUploaded_by)
                {
                    await
                    JobMedia1.
                    setUploaded_by(relatedUploaded_by1);
                }
            
                const relatedUploaded_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const JobMedia2 = await JobMedia.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JobMedia2?.setUploaded_by)
                {
                    await
                    JobMedia2.
                    setUploaded_by(relatedUploaded_by2);
                }
            
        }
        
    
        
    
        
            
            async function associateJobMediaWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JobMedia0 = await JobMedia.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (JobMedia0?.setOrganization)
                {
                    await
                    JobMedia0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JobMedia1 = await JobMedia.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (JobMedia1?.setOrganization)
                {
                    await
                    JobMedia1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const JobMedia2 = await JobMedia.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (JobMedia2?.setOrganization)
                {
                    await
                    JobMedia2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateInvoiceWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setWorkspace)
                {
                    await
                    Invoice0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setWorkspace)
                {
                    await
                    Invoice1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setWorkspace)
                {
                    await
                    Invoice2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
            
            async function associateInvoiceWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setCustomer)
                {
                    await
                    Invoice0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setCustomer)
                {
                    await
                    Invoice1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setCustomer)
                {
                    await
                    Invoice2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
            
            async function associateInvoiceWithJob() {
            
                const relatedJob0 = await Jobs.findOne({
                    offset: Math.floor(Math.random() * (await Jobs.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setJob)
                {
                    await
                    Invoice0.
                    setJob(relatedJob0);
                }
            
                const relatedJob1 = await Jobs.findOne({
                    offset: Math.floor(Math.random() * (await Jobs.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setJob)
                {
                    await
                    Invoice1.
                    setJob(relatedJob1);
                }
            
                const relatedJob2 = await Jobs.findOne({
                    offset: Math.floor(Math.random() * (await Jobs.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setJob)
                {
                    await
                    Invoice2.
                    setJob(relatedJob2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateInvoiceWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setOrganization)
                {
                    await
                    Invoice0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setOrganization)
                {
                    await
                    Invoice1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setOrganization)
                {
                    await
                    Invoice2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateInvoiceLineItemWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const InvoiceLineItem0 = await InvoiceLineItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InvoiceLineItem0?.setWorkspace)
                {
                    await
                    InvoiceLineItem0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const InvoiceLineItem1 = await InvoiceLineItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InvoiceLineItem1?.setWorkspace)
                {
                    await
                    InvoiceLineItem1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const InvoiceLineItem2 = await InvoiceLineItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InvoiceLineItem2?.setWorkspace)
                {
                    await
                    InvoiceLineItem2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
            
            async function associateInvoiceLineItemWithInvoice() {
            
                const relatedInvoice0 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const InvoiceLineItem0 = await InvoiceLineItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InvoiceLineItem0?.setInvoice)
                {
                    await
                    InvoiceLineItem0.
                    setInvoice(relatedInvoice0);
                }
            
                const relatedInvoice1 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const InvoiceLineItem1 = await InvoiceLineItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InvoiceLineItem1?.setInvoice)
                {
                    await
                    InvoiceLineItem1.
                    setInvoice(relatedInvoice1);
                }
            
                const relatedInvoice2 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const InvoiceLineItem2 = await InvoiceLineItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InvoiceLineItem2?.setInvoice)
                {
                    await
                    InvoiceLineItem2.
                    setInvoice(relatedInvoice2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateInvoiceLineItemWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InvoiceLineItem0 = await InvoiceLineItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InvoiceLineItem0?.setOrganization)
                {
                    await
                    InvoiceLineItem0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InvoiceLineItem1 = await InvoiceLineItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InvoiceLineItem1?.setOrganization)
                {
                    await
                    InvoiceLineItem1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InvoiceLineItem2 = await InvoiceLineItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InvoiceLineItem2?.setOrganization)
                {
                    await
                    InvoiceLineItem2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associatePaymentWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setWorkspace)
                {
                    await
                    Payment0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setWorkspace)
                {
                    await
                    Payment1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setWorkspace)
                {
                    await
                    Payment2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
            
            async function associatePaymentWithInvoice() {
            
                const relatedInvoice0 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setInvoice)
                {
                    await
                    Payment0.
                    setInvoice(relatedInvoice0);
                }
            
                const relatedInvoice1 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setInvoice)
                {
                    await
                    Payment1.
                    setInvoice(relatedInvoice1);
                }
            
                const relatedInvoice2 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setInvoice)
                {
                    await
                    Payment2.
                    setInvoice(relatedInvoice2);
                }
            
        }
        
    
        
            
            async function associatePaymentWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setCustomer)
                {
                    await
                    Payment0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setCustomer)
                {
                    await
                    Payment1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setCustomer)
                {
                    await
                    Payment2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePaymentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setOrganization)
                {
                    await
                    Payment0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setOrganization)
                {
                    await
                    Payment1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setOrganization)
                {
                    await
                    Payment2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateEstimateWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Estimate0 = await Estimates.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Estimate0?.setWorkspace)
                {
                    await
                    Estimate0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Estimate1 = await Estimates.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Estimate1?.setWorkspace)
                {
                    await
                    Estimate1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Estimate2 = await Estimates.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Estimate2?.setWorkspace)
                {
                    await
                    Estimate2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
            
            async function associateEstimateWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Estimate0 = await Estimates.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Estimate0?.setCustomer)
                {
                    await
                    Estimate0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Estimate1 = await Estimates.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Estimate1?.setCustomer)
                {
                    await
                    Estimate1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Estimate2 = await Estimates.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Estimate2?.setCustomer)
                {
                    await
                    Estimate2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
            
            async function associateEstimateWithProperty() {
            
                const relatedProperty0 = await Properties.findOne({
                    offset: Math.floor(Math.random() * (await Properties.count())),
                });
                const Estimate0 = await Estimates.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Estimate0?.setProperty)
                {
                    await
                    Estimate0.
                    setProperty(relatedProperty0);
                }
            
                const relatedProperty1 = await Properties.findOne({
                    offset: Math.floor(Math.random() * (await Properties.count())),
                });
                const Estimate1 = await Estimates.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Estimate1?.setProperty)
                {
                    await
                    Estimate1.
                    setProperty(relatedProperty1);
                }
            
                const relatedProperty2 = await Properties.findOne({
                    offset: Math.floor(Math.random() * (await Properties.count())),
                });
                const Estimate2 = await Estimates.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Estimate2?.setProperty)
                {
                    await
                    Estimate2.
                    setProperty(relatedProperty2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateEstimateWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Estimate0 = await Estimates.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Estimate0?.setOrganization)
                {
                    await
                    Estimate0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Estimate1 = await Estimates.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Estimate1?.setOrganization)
                {
                    await
                    Estimate1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Estimate2 = await Estimates.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Estimate2?.setOrganization)
                {
                    await
                    Estimate2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateEstimateLineItemWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const EstimateLineItem0 = await EstimateLineItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EstimateLineItem0?.setWorkspace)
                {
                    await
                    EstimateLineItem0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const EstimateLineItem1 = await EstimateLineItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EstimateLineItem1?.setWorkspace)
                {
                    await
                    EstimateLineItem1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const EstimateLineItem2 = await EstimateLineItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EstimateLineItem2?.setWorkspace)
                {
                    await
                    EstimateLineItem2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
            
            async function associateEstimateLineItemWithEstimate() {
            
                const relatedEstimate0 = await Estimates.findOne({
                    offset: Math.floor(Math.random() * (await Estimates.count())),
                });
                const EstimateLineItem0 = await EstimateLineItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EstimateLineItem0?.setEstimate)
                {
                    await
                    EstimateLineItem0.
                    setEstimate(relatedEstimate0);
                }
            
                const relatedEstimate1 = await Estimates.findOne({
                    offset: Math.floor(Math.random() * (await Estimates.count())),
                });
                const EstimateLineItem1 = await EstimateLineItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EstimateLineItem1?.setEstimate)
                {
                    await
                    EstimateLineItem1.
                    setEstimate(relatedEstimate1);
                }
            
                const relatedEstimate2 = await Estimates.findOne({
                    offset: Math.floor(Math.random() * (await Estimates.count())),
                });
                const EstimateLineItem2 = await EstimateLineItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EstimateLineItem2?.setEstimate)
                {
                    await
                    EstimateLineItem2.
                    setEstimate(relatedEstimate2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateEstimateLineItemWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EstimateLineItem0 = await EstimateLineItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EstimateLineItem0?.setOrganization)
                {
                    await
                    EstimateLineItem0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EstimateLineItem1 = await EstimateLineItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EstimateLineItem1?.setOrganization)
                {
                    await
                    EstimateLineItem1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EstimateLineItem2 = await EstimateLineItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EstimateLineItem2?.setOrganization)
                {
                    await
                    EstimateLineItem2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateRecurringScheduleWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const RecurringSchedule0 = await RecurringSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RecurringSchedule0?.setWorkspace)
                {
                    await
                    RecurringSchedule0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const RecurringSchedule1 = await RecurringSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RecurringSchedule1?.setWorkspace)
                {
                    await
                    RecurringSchedule1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const RecurringSchedule2 = await RecurringSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RecurringSchedule2?.setWorkspace)
                {
                    await
                    RecurringSchedule2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
            
            async function associateRecurringScheduleWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const RecurringSchedule0 = await RecurringSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RecurringSchedule0?.setCustomer)
                {
                    await
                    RecurringSchedule0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const RecurringSchedule1 = await RecurringSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RecurringSchedule1?.setCustomer)
                {
                    await
                    RecurringSchedule1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const RecurringSchedule2 = await RecurringSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RecurringSchedule2?.setCustomer)
                {
                    await
                    RecurringSchedule2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
            
            async function associateRecurringScheduleWithProperty() {
            
                const relatedProperty0 = await Properties.findOne({
                    offset: Math.floor(Math.random() * (await Properties.count())),
                });
                const RecurringSchedule0 = await RecurringSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RecurringSchedule0?.setProperty)
                {
                    await
                    RecurringSchedule0.
                    setProperty(relatedProperty0);
                }
            
                const relatedProperty1 = await Properties.findOne({
                    offset: Math.floor(Math.random() * (await Properties.count())),
                });
                const RecurringSchedule1 = await RecurringSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RecurringSchedule1?.setProperty)
                {
                    await
                    RecurringSchedule1.
                    setProperty(relatedProperty1);
                }
            
                const relatedProperty2 = await Properties.findOne({
                    offset: Math.floor(Math.random() * (await Properties.count())),
                });
                const RecurringSchedule2 = await RecurringSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RecurringSchedule2?.setProperty)
                {
                    await
                    RecurringSchedule2.
                    setProperty(relatedProperty2);
                }
            
        }
        
    
        
            
            async function associateRecurringScheduleWithService_catalog_item() {
            
                const relatedService_catalog_item0 = await ServiceCatalogItems.findOne({
                    offset: Math.floor(Math.random() * (await ServiceCatalogItems.count())),
                });
                const RecurringSchedule0 = await RecurringSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RecurringSchedule0?.setService_catalog_item)
                {
                    await
                    RecurringSchedule0.
                    setService_catalog_item(relatedService_catalog_item0);
                }
            
                const relatedService_catalog_item1 = await ServiceCatalogItems.findOne({
                    offset: Math.floor(Math.random() * (await ServiceCatalogItems.count())),
                });
                const RecurringSchedule1 = await RecurringSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RecurringSchedule1?.setService_catalog_item)
                {
                    await
                    RecurringSchedule1.
                    setService_catalog_item(relatedService_catalog_item1);
                }
            
                const relatedService_catalog_item2 = await ServiceCatalogItems.findOne({
                    offset: Math.floor(Math.random() * (await ServiceCatalogItems.count())),
                });
                const RecurringSchedule2 = await RecurringSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RecurringSchedule2?.setService_catalog_item)
                {
                    await
                    RecurringSchedule2.
                    setService_catalog_item(relatedService_catalog_item2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateRecurringScheduleWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RecurringSchedule0 = await RecurringSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RecurringSchedule0?.setOrganization)
                {
                    await
                    RecurringSchedule0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RecurringSchedule1 = await RecurringSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RecurringSchedule1?.setOrganization)
                {
                    await
                    RecurringSchedule1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RecurringSchedule2 = await RecurringSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RecurringSchedule2?.setOrganization)
                {
                    await
                    RecurringSchedule2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateNotificationWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Notification0 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Notification0?.setWorkspace)
                {
                    await
                    Notification0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Notification1 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Notification1?.setWorkspace)
                {
                    await
                    Notification1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Notification2 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Notification2?.setWorkspace)
                {
                    await
                    Notification2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
            
            async function associateNotificationWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Notification0 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Notification0?.setUser)
                {
                    await
                    Notification0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Notification1 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Notification1?.setUser)
                {
                    await
                    Notification1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Notification2 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Notification2?.setUser)
                {
                    await
                    Notification2.
                    setUser(relatedUser2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateNotificationWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Notification0 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Notification0?.setOrganization)
                {
                    await
                    Notification0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Notification1 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Notification1?.setOrganization)
                {
                    await
                    Notification1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Notification2 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Notification2?.setOrganization)
                {
                    await
                    Notification2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateSupportTicketWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const SupportTicket0 = await SupportTickets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SupportTicket0?.setWorkspace)
                {
                    await
                    SupportTicket0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const SupportTicket1 = await SupportTickets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SupportTicket1?.setWorkspace)
                {
                    await
                    SupportTicket1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const SupportTicket2 = await SupportTickets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SupportTicket2?.setWorkspace)
                {
                    await
                    SupportTicket2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
            
            async function associateSupportTicketWithRequester() {
            
                const relatedRequester0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SupportTicket0 = await SupportTickets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SupportTicket0?.setRequester)
                {
                    await
                    SupportTicket0.
                    setRequester(relatedRequester0);
                }
            
                const relatedRequester1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SupportTicket1 = await SupportTickets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SupportTicket1?.setRequester)
                {
                    await
                    SupportTicket1.
                    setRequester(relatedRequester1);
                }
            
                const relatedRequester2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SupportTicket2 = await SupportTickets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SupportTicket2?.setRequester)
                {
                    await
                    SupportTicket2.
                    setRequester(relatedRequester2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateSupportTicketWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SupportTicket0 = await SupportTickets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SupportTicket0?.setOrganization)
                {
                    await
                    SupportTicket0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SupportTicket1 = await SupportTickets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SupportTicket1?.setOrganization)
                {
                    await
                    SupportTicket1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SupportTicket2 = await SupportTickets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SupportTicket2?.setOrganization)
                {
                    await
                    SupportTicket2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePlanWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Plan0 = await Plans.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Plan0?.setOrganization)
                {
                    await
                    Plan0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Plan1 = await Plans.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Plan1?.setOrganization)
                {
                    await
                    Plan1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Plan2 = await Plans.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Plan2?.setOrganization)
                {
                    await
                    Plan2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateSubscriptionWithWorkspace() {
            
                const relatedWorkspace0 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Subscription0 = await Subscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Subscription0?.setWorkspace)
                {
                    await
                    Subscription0.
                    setWorkspace(relatedWorkspace0);
                }
            
                const relatedWorkspace1 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Subscription1 = await Subscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Subscription1?.setWorkspace)
                {
                    await
                    Subscription1.
                    setWorkspace(relatedWorkspace1);
                }
            
                const relatedWorkspace2 = await Workspaces.findOne({
                    offset: Math.floor(Math.random() * (await Workspaces.count())),
                });
                const Subscription2 = await Subscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Subscription2?.setWorkspace)
                {
                    await
                    Subscription2.
                    setWorkspace(relatedWorkspace2);
                }
            
        }
        
    
        
            
            async function associateSubscriptionWithPlan() {
            
                const relatedPlan0 = await Plans.findOne({
                    offset: Math.floor(Math.random() * (await Plans.count())),
                });
                const Subscription0 = await Subscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Subscription0?.setPlan)
                {
                    await
                    Subscription0.
                    setPlan(relatedPlan0);
                }
            
                const relatedPlan1 = await Plans.findOne({
                    offset: Math.floor(Math.random() * (await Plans.count())),
                });
                const Subscription1 = await Subscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Subscription1?.setPlan)
                {
                    await
                    Subscription1.
                    setPlan(relatedPlan1);
                }
            
                const relatedPlan2 = await Plans.findOne({
                    offset: Math.floor(Math.random() * (await Plans.count())),
                });
                const Subscription2 = await Subscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Subscription2?.setPlan)
                {
                    await
                    Subscription2.
                    setPlan(relatedPlan2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateSubscriptionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Subscription0 = await Subscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Subscription0?.setOrganization)
                {
                    await
                    Subscription0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Subscription1 = await Subscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Subscription1?.setOrganization)
                {
                    await
                    Subscription1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Subscription2 = await Subscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Subscription2?.setOrganization)
                {
                    await
                    Subscription2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Organizations.bulkCreate(OrganizationsData);
                
            
            
                
                await Workspaces.bulkCreate(WorkspacesData);
                
            
            
                
                await WorkspaceMemberships.bulkCreate(WorkspaceMembershipsData);
                
            
            
                
                await ServiceCatalogItems.bulkCreate(ServiceCatalogItemsData);
                
            
            
                
                await Customers.bulkCreate(CustomersData);
                
            
            
                
                await Properties.bulkCreate(PropertiesData);
                
            
            
                
                await JobTemplates.bulkCreate(JobTemplatesData);
                
            
            
                
                await Jobs.bulkCreate(JobsData);
                
            
            
                
                await JobAssignments.bulkCreate(JobAssignmentsData);
                
            
            
                
                await Checklists.bulkCreate(ChecklistsData);
                
            
            
                
                await ChecklistItems.bulkCreate(ChecklistItemsData);
                
            
            
                
                await JobChecklistRuns.bulkCreate(JobChecklistRunsData);
                
            
            
                
                await JobChecklistRunItems.bulkCreate(JobChecklistRunItemsData);
                
            
            
                
                await JobMedia.bulkCreate(JobMediaData);
                
            
            
                
                await Invoices.bulkCreate(InvoicesData);
                
            
            
                
                await InvoiceLineItems.bulkCreate(InvoiceLineItemsData);
                
            
            
                
                await Payments.bulkCreate(PaymentsData);
                
            
            
                
                await Estimates.bulkCreate(EstimatesData);
                
            
            
                
                await EstimateLineItems.bulkCreate(EstimateLineItemsData);
                
            
            
                
                await RecurringSchedules.bulkCreate(RecurringSchedulesData);
                
            
            
                
                await Notifications.bulkCreate(NotificationsData);
                
            
            
                
                await SupportTickets.bulkCreate(SupportTicketsData);
                
            
            
                
                await Plans.bulkCreate(PlansData);
                
            
            
                
                await Subscriptions.bulkCreate(SubscriptionsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateUserWithOrganization(),
                    
                
            
                
                
                
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateWorkspaceWithOwner(),
                    
                
                    
                        
                        await associateWorkspaceWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateWorkspaceMembershipWithWorkspace(),
                    
                
                    
                        
                        await associateWorkspaceMembershipWithUser(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateWorkspaceMembershipWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateServiceCatalogItemWithWorkspace(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateServiceCatalogItemWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCustomerWithWorkspace(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCustomerWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associatePropertyWithWorkspace(),
                    
                
                    
                        
                        await associatePropertyWithCustomer(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePropertyWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateJobTemplateWithWorkspace(),
                    
                
                    
                
                    
                        
                        await associateJobTemplateWithService_catalog_item(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateJobTemplateWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateJobWithWorkspace(),
                    
                
                    
                        
                        await associateJobWithCustomer(),
                    
                
                    
                        
                        await associateJobWithProperty(),
                    
                
                    
                        
                        await associateJobWithService_catalog_item(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateJobWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateJobAssignmentWithWorkspace(),
                    
                
                    
                        
                        await associateJobAssignmentWithJob(),
                    
                
                    
                        
                        await associateJobAssignmentWithAssignee(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateJobAssignmentWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateChecklistWithWorkspace(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateChecklistWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateChecklistItemWithWorkspace(),
                    
                
                    
                        
                        await associateChecklistItemWithChecklist(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateChecklistItemWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateJobChecklistRunWithWorkspace(),
                    
                
                    
                        
                        await associateJobChecklistRunWithJob(),
                    
                
                    
                        
                        await associateJobChecklistRunWithChecklist(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateJobChecklistRunWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateJobChecklistRunItemWithWorkspace(),
                    
                
                    
                        
                        await associateJobChecklistRunItemWithJob_checklist_run(),
                    
                
                    
                        
                        await associateJobChecklistRunItemWithChecklist_item(),
                    
                
                    
                
                    
                
                    
                        
                        await associateJobChecklistRunItemWithCompleted_by(),
                    
                
                    
                
                    
                        
                        await associateJobChecklistRunItemWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateJobMediaWithWorkspace(),
                    
                
                    
                        
                        await associateJobMediaWithJob(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateJobMediaWithUploaded_by(),
                    
                
                    
                
                    
                        
                        await associateJobMediaWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateInvoiceWithWorkspace(),
                    
                
                    
                        
                        await associateInvoiceWithCustomer(),
                    
                
                    
                        
                        await associateInvoiceWithJob(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInvoiceWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateInvoiceLineItemWithWorkspace(),
                    
                
                    
                        
                        await associateInvoiceLineItemWithInvoice(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInvoiceLineItemWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associatePaymentWithWorkspace(),
                    
                
                    
                        
                        await associatePaymentWithInvoice(),
                    
                
                    
                        
                        await associatePaymentWithCustomer(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePaymentWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateEstimateWithWorkspace(),
                    
                
                    
                        
                        await associateEstimateWithCustomer(),
                    
                
                    
                        
                        await associateEstimateWithProperty(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateEstimateWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateEstimateLineItemWithWorkspace(),
                    
                
                    
                        
                        await associateEstimateLineItemWithEstimate(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateEstimateLineItemWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateRecurringScheduleWithWorkspace(),
                    
                
                    
                        
                        await associateRecurringScheduleWithCustomer(),
                    
                
                    
                        
                        await associateRecurringScheduleWithProperty(),
                    
                
                    
                        
                        await associateRecurringScheduleWithService_catalog_item(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateRecurringScheduleWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateNotificationWithWorkspace(),
                    
                
                    
                        
                        await associateNotificationWithUser(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateNotificationWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateSupportTicketWithWorkspace(),
                    
                
                    
                        
                        await associateSupportTicketWithRequester(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateSupportTicketWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePlanWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateSubscriptionWithWorkspace(),
                    
                
                    
                        
                        await associateSubscriptionWithPlan(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateSubscriptionWithOrganization(),
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('organizations', null, {});
            
            
            await queryInterface.bulkDelete('workspaces', null, {});
            
            
            await queryInterface.bulkDelete('workspace_memberships', null, {});
            
            
            await queryInterface.bulkDelete('service_catalog_items', null, {});
            
            
            await queryInterface.bulkDelete('customers', null, {});
            
            
            await queryInterface.bulkDelete('properties', null, {});
            
            
            await queryInterface.bulkDelete('job_templates', null, {});
            
            
            await queryInterface.bulkDelete('jobs', null, {});
            
            
            await queryInterface.bulkDelete('job_assignments', null, {});
            
            
            await queryInterface.bulkDelete('checklists', null, {});
            
            
            await queryInterface.bulkDelete('checklist_items', null, {});
            
            
            await queryInterface.bulkDelete('job_checklist_runs', null, {});
            
            
            await queryInterface.bulkDelete('job_checklist_run_items', null, {});
            
            
            await queryInterface.bulkDelete('job_media', null, {});
            
            
            await queryInterface.bulkDelete('invoices', null, {});
            
            
            await queryInterface.bulkDelete('invoice_line_items', null, {});
            
            
            await queryInterface.bulkDelete('payments', null, {});
            
            
            await queryInterface.bulkDelete('estimates', null, {});
            
            
            await queryInterface.bulkDelete('estimate_line_items', null, {});
            
            
            await queryInterface.bulkDelete('recurring_schedules', null, {});
            
            
            await queryInterface.bulkDelete('notifications', null, {});
            
            
            await queryInterface.bulkDelete('support_tickets', null, {});
            
            
            await queryInterface.bulkDelete('plans', null, {});
            
            
            await queryInterface.bulkDelete('subscriptions', null, {});
            
        
    },
};