





















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






const Titles = db.titles;

const Genres = db.genres;

const TitleGenres = db.title_genres;

const People = db.people;

const TitleCast = db.title_cast;

const TitleCrew = db.title_crew;

const Videos = db.videos;

const Watchlists = db.watchlists;

const WatchlistItems = db.watchlist_items;

const UserRatings = db.user_ratings;

const Recommendations = db.recommendations;

const TrendingEntries = db.trending_entries;







const TitlesData = [
    
    {
    
        
        
            
                "title_type": "movie",
            
        
    
        
        
            
                "name": "Echoes of Tomorrow",
            
        
    
        
        
            
                "original_name": "Echoes of Tomorrow",
            
        
    
        
        
            
                "tagline": "The future remembers.",
            
        
    
        
        
            
                "overview": "A time-loop engineer races to prevent a disaster while untangling a personal mystery.",
            
        
    
        
        
            
                "release_date": new Date('2024-10-18T00:00:00Z'),
            
        
    
        
        
            
                "first_air_date": new Date('2024-10-18T00:00:00Z'),
            
        
    
        
        
            
                "last_air_date": new Date('2024-10-18T00:00:00Z'),
            
        
    
        
        
            
                "content_rating": "tv_14",
            
        
    
        
        
            
                "original_language": "en",
            
        
    
        
        
            
                "runtime_minutes": 122,
            
        
    
        
        
            
                "number_of_seasons": 0,
            
        
    
        
        
            
                "number_of_episodes": 0,
            
        
    
        
        
            
                "average_rating": 8.1,
            
        
    
        
        
            
                "rating_count": 18450,
            
        
    
        
        
            
                "popularity_score": 92.4,
            
        
    
        
        
            
                "imdb_code": "tt31012010",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "is_trending": true,
            
        
    
    },
    
    {
    
        
        
            
                "title_type": "tv_show",
            
        
    
        
        
            
                "name": "Harbor Lights",
            
        
    
        
        
            
                "original_name": "Harbor Lights",
            
        
    
        
        
            
                "tagline": "Every secret has a tide.",
            
        
    
        
        
            
                "overview": "A coastal town detective investigates interconnected cases that reveal long-buried secrets.",
            
        
    
        
        
            
                "release_date": new Date('2023-01-12T00:00:00Z'),
            
        
    
        
        
            
                "first_air_date": new Date('2023-01-12T00:00:00Z'),
            
        
    
        
        
            
                "last_air_date": new Date('2025-03-20T00:00:00Z'),
            
        
    
        
        
            
                "content_rating": "tv_14",
            
        
    
        
        
            
                "original_language": "en",
            
        
    
        
        
            
                "runtime_minutes": 50,
            
        
    
        
        
            
                "number_of_seasons": 3,
            
        
    
        
        
            
                "number_of_episodes": 30,
            
        
    
        
        
            
                "average_rating": 7.6,
            
        
    
        
        
            
                "rating_count": 9800,
            
        
    
        
        
            
                "popularity_score": 78.9,
            
        
    
        
        
            
                "imdb_code": "tt21104567",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "is_trending": true,
            
        
    
    },
    
    {
    
        
        
            
                "title_type": "movie",
            
        
    
        
        
            
                "name": "The Last Orchestra",
            
        
    
        
        
            
                "original_name": "The Last Orchestra",
            
        
    
        
        
            
                "tagline": "One concert to change everything.",
            
        
    
        
        
            
                "overview": "A disgraced conductor reunites a fractured ensemble for a final performance.",
            
        
    
        
        
            
                "release_date": new Date('2022-05-06T00:00:00Z'),
            
        
    
        
        
            
                "first_air_date": new Date('2022-05-06T00:00:00Z'),
            
        
    
        
        
            
                "last_air_date": new Date('2022-05-06T00:00:00Z'),
            
        
    
        
        
            
                "content_rating": "tv_pg",
            
        
    
        
        
            
                "original_language": "en",
            
        
    
        
        
            
                "runtime_minutes": 110,
            
        
    
        
        
            
                "number_of_seasons": 0,
            
        
    
        
        
            
                "number_of_episodes": 0,
            
        
    
        
        
            
                "average_rating": 7.9,
            
        
    
        
        
            
                "rating_count": 6400,
            
        
    
        
        
            
                "popularity_score": 55.2,
            
        
    
        
        
            
                "imdb_code": "tt14560022",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "is_trending": true,
            
        
    
    },
    
    {
    
        
        
            
                "title_type": "tv_show",
            
        
    
        
        
            
                "name": "Circuit Breakers",
            
        
    
        
        
            
                "original_name": "Circuit Breakers",
            
        
    
        
        
            
                "tagline": "Power has a price.",
            
        
    
        
        
            
                "overview": "An ensemble drama following engineers and activists battling over a revolutionary energy grid.",
            
        
    
        
        
            
                "release_date": new Date('2024-02-02T00:00:00Z'),
            
        
    
        
        
            
                "first_air_date": new Date('2024-02-02T00:00:00Z'),
            
        
    
        
        
            
                "last_air_date": new Date('2024-11-15T00:00:00Z'),
            
        
    
        
        
            
                "content_rating": "tv_y",
            
        
    
        
        
            
                "original_language": "en",
            
        
    
        
        
            
                "runtime_minutes": 55,
            
        
    
        
        
            
                "number_of_seasons": 2,
            
        
    
        
        
            
                "number_of_episodes": 16,
            
        
    
        
        
            
                "average_rating": 8.3,
            
        
    
        
        
            
                "rating_count": 12100,
            
        
    
        
        
            
                "popularity_score": 88.1,
            
        
    
        
        
            
                "imdb_code": "tt27990112",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "is_trending": true,
            
        
    
    },
    
    {
    
        
        
            
                "title_type": "movie",
            
        
    
        
        
            
                "name": "Paper Moons",
            
        
    
        
        
            
                "original_name": "Paper Moons",
            
        
    
        
        
            
                "tagline": "Small moments, big changes.",
            
        
    
        
        
            
                "overview": "A gentle coming-of-age story about friendship, art, and finding courage in a new city.",
            
        
    
        
        
            
                "release_date": new Date('2021-09-24T00:00:00Z'),
            
        
    
        
        
            
                "first_air_date": new Date('2021-09-24T00:00:00Z'),
            
        
    
        
        
            
                "last_air_date": new Date('2021-09-24T00:00:00Z'),
            
        
    
        
        
            
                "content_rating": "tv_pg",
            
        
    
        
        
            
                "original_language": "en",
            
        
    
        
        
            
                "runtime_minutes": 98,
            
        
    
        
        
            
                "number_of_seasons": 0,
            
        
    
        
        
            
                "number_of_episodes": 0,
            
        
    
        
        
            
                "average_rating": 7.2,
            
        
    
        
        
            
                "rating_count": 3200,
            
        
    
        
        
            
                "popularity_score": 41.7,
            
        
    
        
        
            
                "imdb_code": "tt13370998",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "is_trending": true,
            
        
    
    },
    
];



const GenresData = [
    
    {
    
        
        
            
                "name": "Science Fiction",
            
        
    
        
        
            
                "slug": "science-fiction",
            
        
    
        
        
            
                "description": "Futuristic stories with advanced technology and speculative ideas.",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Crime Drama",
            
        
    
        
        
            
                "slug": "crime-drama",
            
        
    
        
        
            
                "description": "Investigations, moral dilemmas, and the human side of crime.",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Music",
            
        
    
        
        
            
                "slug": "music",
            
        
    
        
        
            
                "description": "Stories centered on musicians, performance, and artistic ambition.",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Thriller",
            
        
    
        
        
            
                "slug": "thriller",
            
        
    
        
        
            
                "description": "High-stakes suspense with twists and intense pacing.",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Coming of Age",
            
        
    
        
        
            
                "slug": "coming-of-age",
            
        
    
        
        
            
                "description": "Personal growth stories focused on youth and transition.",
            
        
    
    },
    
];



const TitleGenresData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                // 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
            
        
    
    },
    
];



const PeopleData = [
    
    {
    
        
        
            
                "name": "Morgan Lee",
            
        
    
        
        
            
                "known_for_department": "Acting",
            
        
    
        
        
            
                "birth_date": new Date('1988-07-14T00:00:00Z'),
            
        
    
        
        
            
                "death_date": new Date('1988-07-14T00:00:00Z'),
            
        
    
        
        
            
                "biography": "Known for grounded performances in modern dramas and thrillers.",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Elena Park",
            
        
    
        
        
            
                "known_for_department": "Directing",
            
        
    
        
        
            
                "birth_date": new Date('1979-03-02T00:00:00Z'),
            
        
    
        
        
            
                "death_date": new Date('1979-03-02T00:00:00Z'),
            
        
    
        
        
            
                "biography": "Director celebrated for atmospheric storytelling and character-driven plots.",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Rafael Costa",
            
        
    
        
        
            
                "known_for_department": "Writing",
            
        
    
        
        
            
                "birth_date": new Date('1983-11-21T00:00:00Z'),
            
        
    
        
        
            
                "death_date": new Date('1983-11-21T00:00:00Z'),
            
        
    
        
        
            
                "biography": "Screenwriter focused on speculative fiction and grounded science narratives.",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Sofia Nguyen",
            
        
    
        
        
            
                "known_for_department": "Production",
            
        
    
        
        
            
                "birth_date": new Date('1975-05-09T00:00:00Z'),
            
        
    
        
        
            
                "death_date": new Date('1975-05-09T00:00:00Z'),
            
        
    
        
        
            
                "biography": "Producer with a track record of acclaimed limited series and ensemble casts.",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Daniel Kim",
            
        
    
        
        
            
                "known_for_department": "Acting",
            
        
    
        
        
            
                "birth_date": new Date('1991-01-30T00:00:00Z'),
            
        
    
        
        
            
                "death_date": new Date('1991-01-30T00:00:00Z'),
            
        
    
        
        
            
                "biography": "Performs in genre projects spanning sci-fi, comedy, and action.",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
    },
    
];



const TitleCastData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "character_name": "Dr. Mira Hale",
            
        
    
        
        
            
                "billing_order": 1,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "character_name": "Detective Jonah Park",
            
        
    
        
        
            
                "billing_order": 1,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "character_name": "Clara Wynn",
            
        
    
        
        
            
                "billing_order": 2,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "character_name": "Evan Cho",
            
        
    
        
        
            
                "billing_order": 2,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "character_name": "Avery Reed",
            
        
    
        
        
            
                "billing_order": 1,
            
        
    
    },
    
];



const TitleCrewData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "department": "directing",
            
        
    
        
        
            
                "job": "Director",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "department": "visual_effects",
            
        
    
        
        
            
                "job": "Screenwriter",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "department": "editing",
            
        
    
        
        
            
                "job": "Executive Producer",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "department": "camera",
            
        
    
        
        
            
                "job": "Lead Director",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "department": "visual_effects",
            
        
    
        
        
            
                "job": "Story Consultant",
            
        
    
    },
    
];



const VideosData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "video_type": "behind_the_scenes",
            
        
    
        
        
            
                "name": "Official Trailer",
            
        
    
        
        
            
                "video_url": "https://video.example.com/echoes-of-tomorrow-trailer",
            
        
    
        
        
            
                "site": "ExampleVideo",
            
        
    
        
        
            
                "external_key": "eot_trailer_01",
            
        
    
        
        
            
                "size": 1080,
            
        
    
        
        
            
                "published_at": new Date('2024-08-20T12:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "video_type": "featurette",
            
        
    
        
        
            
                "name": "Season 3 Teaser",
            
        
    
        
        
            
                "video_url": "https://video.example.com/harbor-lights-s3-teaser",
            
        
    
        
        
            
                "site": "ExampleVideo",
            
        
    
        
        
            
                "external_key": "hl_s3_teaser",
            
        
    
        
        
            
                "size": 1080,
            
        
    
        
        
            
                "published_at": new Date('2025-02-10T10:30:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "video_type": "teaser",
            
        
    
        
        
            
                "name": "Behind the Music",
            
        
    
        
        
            
                "video_url": "https://video.example.com/last-orchestra-featurette",
            
        
    
        
        
            
                "site": "ExampleVideo",
            
        
    
        
        
            
                "external_key": "tlo_feat_01",
            
        
    
        
        
            
                "size": 1080,
            
        
    
        
        
            
                "published_at": new Date('2022-04-12T15:45:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "video_type": "clip",
            
        
    
        
        
            
                "name": "Grid Room Scene",
            
        
    
        
        
            
                "video_url": "https://video.example.com/circuit-breakers-clip-grid-room",
            
        
    
        
        
            
                "site": "ExampleVideo",
            
        
    
        
        
            
                "external_key": "cb_clip_02",
            
        
    
        
        
            
                "size": 1080,
            
        
    
        
        
            
                "published_at": new Date('2024-03-05T09:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "video_type": "featurette",
            
        
    
        
        
            
                "name": "Official Trailer",
            
        
    
        
        
            
                "video_url": "https://video.example.com/paper-moons-trailer",
            
        
    
        
        
            
                "site": "ExampleVideo",
            
        
    
        
        
            
                "external_key": "pm_trailer_01",
            
        
    
        
        
            
                "size": 1080,
            
        
    
        
        
            
                "published_at": new Date('2021-08-18T14:00:00Z'),
            
        
    
    },
    
];



const WatchlistsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Weekend Picks",
            
        
    
        
        
            
                "description": "Movies and shows queued for weekends.",
            
        
    
        
        
            
                "is_public": true,
            
        
    
        
        
            
                "visibility": "private",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Sci-Fi Marathon",
            
        
    
        
        
            
                "description": "Time travel, space, and speculative tech.",
            
        
    
        
        
            
                "is_public": false,
            
        
    
        
        
            
                "visibility": "friends",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Top TV Dramas",
            
        
    
        
        
            
                "description": "Character-focused series with strong writing.",
            
        
    
        
        
            
                "is_public": false,
            
        
    
        
        
            
                "visibility": "public",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Poster Worthy",
            
        
    
        
        
            
                "description": "Great cinematography and memorable visuals.",
            
        
    
        
        
            
                "is_public": true,
            
        
    
        
        
            
                "visibility": "friends",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Comfort Watches",
            
        
    
        
        
            
                "description": "Lighthearted titles for relaxing evenings.",
            
        
    
        
        
            
                "is_public": true,
            
        
    
        
        
            
                "visibility": "friends",
            
        
    
    },
    
];



const WatchlistItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "on_hold",
            
        
    
        
        
            
                "added_at": new Date('2026-04-01T17:10:00Z'),
            
        
    
        
        
            
                "watched_at": new Date('2026-04-01T17:10:00Z'),
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
        
        
            
                "note": "Looks like a smart sci-fi thriller.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "dropped",
            
        
    
        
        
            
                "added_at": new Date('2026-03-05T08:00:00Z'),
            
        
    
        
        
            
                "watched_at": new Date('2026-03-07T21:15:00Z'),
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
        
        
            
                "note": "Great pacing and a strong lead.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "plan_to_watch",
            
        
    
        
        
            
                "added_at": new Date('2026-02-18T19:40:00Z'),
            
        
    
        
        
            
                "watched_at": new Date('2026-02-18T19:40:00Z'),
            
        
    
        
        
            
                "sort_order": 2,
            
        
    
        
        
            
                "note": "Season 2 twist was excellent.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "watched",
            
        
    
        
        
            
                "added_at": new Date('2026-01-09T11:25:00Z'),
            
        
    
        
        
            
                "watched_at": new Date('2026-01-10T20:00:00Z'),
            
        
    
        
        
            
                "sort_order": 1,
            
        
    
        
        
            
                "note": "Beautiful color palette and framing.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "dropped",
            
        
    
        
        
            
                "added_at": new Date('2026-03-22T16:05:00Z'),
            
        
    
        
        
            
                "watched_at": new Date('2026-03-22T16:05:00Z'),
            
        
    
        
        
            
                "sort_order": 3,
            
        
    
        
        
            
                "note": "Saving for a quiet night.",
            
        
    
    },
    
];



const UserRatingsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "rating": 8.5,
            
        
    
        
        
            
                "review": "Inventive and emotional without overexplaining.",
            
        
    
        
        
            
                "rated_at": new Date('2026-04-02T20:30:00Z'),
            
        
    
        
        
            
                "contains_spoilers": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "rating": 9.0,
            
        
    
        
        
            
                "review": "Strong concept with satisfying payoff.",
            
        
    
        
        
            
                "rated_at": new Date('2026-03-08T09:10:00Z'),
            
        
    
        
        
            
                "contains_spoilers": false,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "rating": 8.0,
            
        
    
        
        
            
                "review": "Great atmosphere and consistent character arcs.",
            
        
    
        
        
            
                "rated_at": new Date('2026-02-25T13:00:00Z'),
            
        
    
        
        
            
                "contains_spoilers": false,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "rating": 7.5,
            
        
    
        
        
            
                "review": "Warm and visually charming, a pleasant watch.",
            
        
    
        
        
            
                "rated_at": new Date('2026-01-11T18:45:00Z'),
            
        
    
        
        
            
                "contains_spoilers": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "rating": 8.2,
            
        
    
        
        
            
                "review": "Uplifting with a lovely soundtrack.",
            
        
    
        
        
            
                "rated_at": new Date('2026-03-30T22:05:00Z'),
            
        
    
        
        
            
                "contains_spoilers": true,
            
        
    
    },
    
];



const RecommendationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "score": 0.86,
            
        
    
        
        
            
                "reason": "similar_crew",
            
        
    
        
        
            
                "generated_at": new Date('2026-04-03T10:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "score": 0.9,
            
        
    
        
        
            
                "reason": "similar_cast",
            
        
    
        
        
            
                "generated_at": new Date('2026-03-09T08:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "score": 0.62,
            
        
    
        
        
            
                "reason": "popular_now",
            
        
    
        
        
            
                "generated_at": new Date('2026-02-26T09:15:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "score": 0.71,
            
        
    
        
        
            
                "reason": "similar_crew",
            
        
    
        
        
            
                "generated_at": new Date('2026-01-12T12:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "score": 0.68,
            
        
    
        
        
            
                "reason": "similar_genres",
            
        
    
        
        
            
                "generated_at": new Date('2026-03-31T09:30:00Z'),
            
        
    
    },
    
];



const TrendingEntriesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "window": "day",
            
        
    
        
        
            
                "rank": 1,
            
        
    
        
        
            
                "trend_score": 98.7,
            
        
    
        
        
            
                "as_of_at": new Date('2026-04-13T00:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "window": "day",
            
        
    
        
        
            
                "rank": 2,
            
        
    
        
        
            
                "trend_score": 94.1,
            
        
    
        
        
            
                "as_of_at": new Date('2026-04-13T00:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "window": "week",
            
        
    
        
        
            
                "rank": 3,
            
        
    
        
        
            
                "trend_score": 88.3,
            
        
    
        
        
            
                "as_of_at": new Date('2026-04-13T00:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "window": "day",
            
        
    
        
        
            
                "rank": 7,
            
        
    
        
        
            
                "trend_score": 74.9,
            
        
    
        
        
            
                "as_of_at": new Date('2026-04-13T00:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "window": "day",
            
        
    
        
        
            
                "rank": 10,
            
        
    
        
        
            
                "trend_score": 69.5,
            
        
    
        
        
            
                "as_of_at": new Date('2026-04-13T00:00:00Z'),
            
        
    
    },
    
];




    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateTitleGenreWithTitle() {
            
                const relatedTitle0 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const TitleGenre0 = await TitleGenres.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TitleGenre0?.setTitle)
                {
                    await
                    TitleGenre0.
                    setTitle(relatedTitle0);
                }
            
                const relatedTitle1 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const TitleGenre1 = await TitleGenres.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TitleGenre1?.setTitle)
                {
                    await
                    TitleGenre1.
                    setTitle(relatedTitle1);
                }
            
                const relatedTitle2 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const TitleGenre2 = await TitleGenres.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TitleGenre2?.setTitle)
                {
                    await
                    TitleGenre2.
                    setTitle(relatedTitle2);
                }
            
                const relatedTitle3 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const TitleGenre3 = await TitleGenres.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (TitleGenre3?.setTitle)
                {
                    await
                    TitleGenre3.
                    setTitle(relatedTitle3);
                }
            
                const relatedTitle4 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const TitleGenre4 = await TitleGenres.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (TitleGenre4?.setTitle)
                {
                    await
                    TitleGenre4.
                    setTitle(relatedTitle4);
                }
            
        }
        
    
        
            
            async function associateTitleGenreWithGenre() {
            
                const relatedGenre0 = await Genres.findOne({
                    offset: Math.floor(Math.random() * (await Genres.count())),
                });
                const TitleGenre0 = await TitleGenres.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TitleGenre0?.setGenre)
                {
                    await
                    TitleGenre0.
                    setGenre(relatedGenre0);
                }
            
                const relatedGenre1 = await Genres.findOne({
                    offset: Math.floor(Math.random() * (await Genres.count())),
                });
                const TitleGenre1 = await TitleGenres.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TitleGenre1?.setGenre)
                {
                    await
                    TitleGenre1.
                    setGenre(relatedGenre1);
                }
            
                const relatedGenre2 = await Genres.findOne({
                    offset: Math.floor(Math.random() * (await Genres.count())),
                });
                const TitleGenre2 = await TitleGenres.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TitleGenre2?.setGenre)
                {
                    await
                    TitleGenre2.
                    setGenre(relatedGenre2);
                }
            
                const relatedGenre3 = await Genres.findOne({
                    offset: Math.floor(Math.random() * (await Genres.count())),
                });
                const TitleGenre3 = await TitleGenres.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (TitleGenre3?.setGenre)
                {
                    await
                    TitleGenre3.
                    setGenre(relatedGenre3);
                }
            
                const relatedGenre4 = await Genres.findOne({
                    offset: Math.floor(Math.random() * (await Genres.count())),
                });
                const TitleGenre4 = await TitleGenres.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (TitleGenre4?.setGenre)
                {
                    await
                    TitleGenre4.
                    setGenre(relatedGenre4);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateTitleCastWithTitle() {
            
                const relatedTitle0 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const TitleCast0 = await TitleCast.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TitleCast0?.setTitle)
                {
                    await
                    TitleCast0.
                    setTitle(relatedTitle0);
                }
            
                const relatedTitle1 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const TitleCast1 = await TitleCast.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TitleCast1?.setTitle)
                {
                    await
                    TitleCast1.
                    setTitle(relatedTitle1);
                }
            
                const relatedTitle2 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const TitleCast2 = await TitleCast.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TitleCast2?.setTitle)
                {
                    await
                    TitleCast2.
                    setTitle(relatedTitle2);
                }
            
                const relatedTitle3 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const TitleCast3 = await TitleCast.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (TitleCast3?.setTitle)
                {
                    await
                    TitleCast3.
                    setTitle(relatedTitle3);
                }
            
                const relatedTitle4 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const TitleCast4 = await TitleCast.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (TitleCast4?.setTitle)
                {
                    await
                    TitleCast4.
                    setTitle(relatedTitle4);
                }
            
        }
        
    
        
            
            async function associateTitleCastWithPerson() {
            
                const relatedPerson0 = await People.findOne({
                    offset: Math.floor(Math.random() * (await People.count())),
                });
                const TitleCast0 = await TitleCast.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TitleCast0?.setPerson)
                {
                    await
                    TitleCast0.
                    setPerson(relatedPerson0);
                }
            
                const relatedPerson1 = await People.findOne({
                    offset: Math.floor(Math.random() * (await People.count())),
                });
                const TitleCast1 = await TitleCast.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TitleCast1?.setPerson)
                {
                    await
                    TitleCast1.
                    setPerson(relatedPerson1);
                }
            
                const relatedPerson2 = await People.findOne({
                    offset: Math.floor(Math.random() * (await People.count())),
                });
                const TitleCast2 = await TitleCast.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TitleCast2?.setPerson)
                {
                    await
                    TitleCast2.
                    setPerson(relatedPerson2);
                }
            
                const relatedPerson3 = await People.findOne({
                    offset: Math.floor(Math.random() * (await People.count())),
                });
                const TitleCast3 = await TitleCast.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (TitleCast3?.setPerson)
                {
                    await
                    TitleCast3.
                    setPerson(relatedPerson3);
                }
            
                const relatedPerson4 = await People.findOne({
                    offset: Math.floor(Math.random() * (await People.count())),
                });
                const TitleCast4 = await TitleCast.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (TitleCast4?.setPerson)
                {
                    await
                    TitleCast4.
                    setPerson(relatedPerson4);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
            
            async function associateTitleCrewWithTitle() {
            
                const relatedTitle0 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const TitleCrew0 = await TitleCrew.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TitleCrew0?.setTitle)
                {
                    await
                    TitleCrew0.
                    setTitle(relatedTitle0);
                }
            
                const relatedTitle1 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const TitleCrew1 = await TitleCrew.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TitleCrew1?.setTitle)
                {
                    await
                    TitleCrew1.
                    setTitle(relatedTitle1);
                }
            
                const relatedTitle2 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const TitleCrew2 = await TitleCrew.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TitleCrew2?.setTitle)
                {
                    await
                    TitleCrew2.
                    setTitle(relatedTitle2);
                }
            
                const relatedTitle3 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const TitleCrew3 = await TitleCrew.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (TitleCrew3?.setTitle)
                {
                    await
                    TitleCrew3.
                    setTitle(relatedTitle3);
                }
            
                const relatedTitle4 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const TitleCrew4 = await TitleCrew.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (TitleCrew4?.setTitle)
                {
                    await
                    TitleCrew4.
                    setTitle(relatedTitle4);
                }
            
        }
        
    
        
            
            async function associateTitleCrewWithPerson() {
            
                const relatedPerson0 = await People.findOne({
                    offset: Math.floor(Math.random() * (await People.count())),
                });
                const TitleCrew0 = await TitleCrew.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TitleCrew0?.setPerson)
                {
                    await
                    TitleCrew0.
                    setPerson(relatedPerson0);
                }
            
                const relatedPerson1 = await People.findOne({
                    offset: Math.floor(Math.random() * (await People.count())),
                });
                const TitleCrew1 = await TitleCrew.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TitleCrew1?.setPerson)
                {
                    await
                    TitleCrew1.
                    setPerson(relatedPerson1);
                }
            
                const relatedPerson2 = await People.findOne({
                    offset: Math.floor(Math.random() * (await People.count())),
                });
                const TitleCrew2 = await TitleCrew.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TitleCrew2?.setPerson)
                {
                    await
                    TitleCrew2.
                    setPerson(relatedPerson2);
                }
            
                const relatedPerson3 = await People.findOne({
                    offset: Math.floor(Math.random() * (await People.count())),
                });
                const TitleCrew3 = await TitleCrew.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (TitleCrew3?.setPerson)
                {
                    await
                    TitleCrew3.
                    setPerson(relatedPerson3);
                }
            
                const relatedPerson4 = await People.findOne({
                    offset: Math.floor(Math.random() * (await People.count())),
                });
                const TitleCrew4 = await TitleCrew.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (TitleCrew4?.setPerson)
                {
                    await
                    TitleCrew4.
                    setPerson(relatedPerson4);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
            
            async function associateVideoWithTitle() {
            
                const relatedTitle0 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const Video0 = await Videos.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Video0?.setTitle)
                {
                    await
                    Video0.
                    setTitle(relatedTitle0);
                }
            
                const relatedTitle1 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const Video1 = await Videos.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Video1?.setTitle)
                {
                    await
                    Video1.
                    setTitle(relatedTitle1);
                }
            
                const relatedTitle2 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const Video2 = await Videos.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Video2?.setTitle)
                {
                    await
                    Video2.
                    setTitle(relatedTitle2);
                }
            
                const relatedTitle3 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const Video3 = await Videos.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Video3?.setTitle)
                {
                    await
                    Video3.
                    setTitle(relatedTitle3);
                }
            
                const relatedTitle4 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const Video4 = await Videos.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Video4?.setTitle)
                {
                    await
                    Video4.
                    setTitle(relatedTitle4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateWatchlistWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Watchlist0 = await Watchlists.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Watchlist0?.setUser)
                {
                    await
                    Watchlist0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Watchlist1 = await Watchlists.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Watchlist1?.setUser)
                {
                    await
                    Watchlist1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Watchlist2 = await Watchlists.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Watchlist2?.setUser)
                {
                    await
                    Watchlist2.
                    setUser(relatedUser2);
                }
            
                const relatedUser3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Watchlist3 = await Watchlists.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Watchlist3?.setUser)
                {
                    await
                    Watchlist3.
                    setUser(relatedUser3);
                }
            
                const relatedUser4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Watchlist4 = await Watchlists.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Watchlist4?.setUser)
                {
                    await
                    Watchlist4.
                    setUser(relatedUser4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateWatchlistItemWithWatchlist() {
            
                const relatedWatchlist0 = await Watchlists.findOne({
                    offset: Math.floor(Math.random() * (await Watchlists.count())),
                });
                const WatchlistItem0 = await WatchlistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WatchlistItem0?.setWatchlist)
                {
                    await
                    WatchlistItem0.
                    setWatchlist(relatedWatchlist0);
                }
            
                const relatedWatchlist1 = await Watchlists.findOne({
                    offset: Math.floor(Math.random() * (await Watchlists.count())),
                });
                const WatchlistItem1 = await WatchlistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WatchlistItem1?.setWatchlist)
                {
                    await
                    WatchlistItem1.
                    setWatchlist(relatedWatchlist1);
                }
            
                const relatedWatchlist2 = await Watchlists.findOne({
                    offset: Math.floor(Math.random() * (await Watchlists.count())),
                });
                const WatchlistItem2 = await WatchlistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WatchlistItem2?.setWatchlist)
                {
                    await
                    WatchlistItem2.
                    setWatchlist(relatedWatchlist2);
                }
            
                const relatedWatchlist3 = await Watchlists.findOne({
                    offset: Math.floor(Math.random() * (await Watchlists.count())),
                });
                const WatchlistItem3 = await WatchlistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (WatchlistItem3?.setWatchlist)
                {
                    await
                    WatchlistItem3.
                    setWatchlist(relatedWatchlist3);
                }
            
                const relatedWatchlist4 = await Watchlists.findOne({
                    offset: Math.floor(Math.random() * (await Watchlists.count())),
                });
                const WatchlistItem4 = await WatchlistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (WatchlistItem4?.setWatchlist)
                {
                    await
                    WatchlistItem4.
                    setWatchlist(relatedWatchlist4);
                }
            
        }
        
    
        
            
            async function associateWatchlistItemWithTitle() {
            
                const relatedTitle0 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const WatchlistItem0 = await WatchlistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WatchlistItem0?.setTitle)
                {
                    await
                    WatchlistItem0.
                    setTitle(relatedTitle0);
                }
            
                const relatedTitle1 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const WatchlistItem1 = await WatchlistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WatchlistItem1?.setTitle)
                {
                    await
                    WatchlistItem1.
                    setTitle(relatedTitle1);
                }
            
                const relatedTitle2 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const WatchlistItem2 = await WatchlistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WatchlistItem2?.setTitle)
                {
                    await
                    WatchlistItem2.
                    setTitle(relatedTitle2);
                }
            
                const relatedTitle3 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const WatchlistItem3 = await WatchlistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (WatchlistItem3?.setTitle)
                {
                    await
                    WatchlistItem3.
                    setTitle(relatedTitle3);
                }
            
                const relatedTitle4 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const WatchlistItem4 = await WatchlistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (WatchlistItem4?.setTitle)
                {
                    await
                    WatchlistItem4.
                    setTitle(relatedTitle4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateUserRatingWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const UserRating0 = await UserRatings.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (UserRating0?.setUser)
                {
                    await
                    UserRating0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const UserRating1 = await UserRatings.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (UserRating1?.setUser)
                {
                    await
                    UserRating1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const UserRating2 = await UserRatings.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (UserRating2?.setUser)
                {
                    await
                    UserRating2.
                    setUser(relatedUser2);
                }
            
                const relatedUser3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const UserRating3 = await UserRatings.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (UserRating3?.setUser)
                {
                    await
                    UserRating3.
                    setUser(relatedUser3);
                }
            
                const relatedUser4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const UserRating4 = await UserRatings.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (UserRating4?.setUser)
                {
                    await
                    UserRating4.
                    setUser(relatedUser4);
                }
            
        }
        
    
        
            
            async function associateUserRatingWithTitle() {
            
                const relatedTitle0 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const UserRating0 = await UserRatings.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (UserRating0?.setTitle)
                {
                    await
                    UserRating0.
                    setTitle(relatedTitle0);
                }
            
                const relatedTitle1 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const UserRating1 = await UserRatings.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (UserRating1?.setTitle)
                {
                    await
                    UserRating1.
                    setTitle(relatedTitle1);
                }
            
                const relatedTitle2 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const UserRating2 = await UserRatings.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (UserRating2?.setTitle)
                {
                    await
                    UserRating2.
                    setTitle(relatedTitle2);
                }
            
                const relatedTitle3 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const UserRating3 = await UserRatings.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (UserRating3?.setTitle)
                {
                    await
                    UserRating3.
                    setTitle(relatedTitle3);
                }
            
                const relatedTitle4 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const UserRating4 = await UserRatings.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (UserRating4?.setTitle)
                {
                    await
                    UserRating4.
                    setTitle(relatedTitle4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateRecommendationWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Recommendation0 = await Recommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Recommendation0?.setUser)
                {
                    await
                    Recommendation0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Recommendation1 = await Recommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Recommendation1?.setUser)
                {
                    await
                    Recommendation1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Recommendation2 = await Recommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Recommendation2?.setUser)
                {
                    await
                    Recommendation2.
                    setUser(relatedUser2);
                }
            
                const relatedUser3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Recommendation3 = await Recommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Recommendation3?.setUser)
                {
                    await
                    Recommendation3.
                    setUser(relatedUser3);
                }
            
                const relatedUser4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Recommendation4 = await Recommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Recommendation4?.setUser)
                {
                    await
                    Recommendation4.
                    setUser(relatedUser4);
                }
            
        }
        
    
        
            
            async function associateRecommendationWithSource_title() {
            
                const relatedSource_title0 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const Recommendation0 = await Recommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Recommendation0?.setSource_title)
                {
                    await
                    Recommendation0.
                    setSource_title(relatedSource_title0);
                }
            
                const relatedSource_title1 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const Recommendation1 = await Recommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Recommendation1?.setSource_title)
                {
                    await
                    Recommendation1.
                    setSource_title(relatedSource_title1);
                }
            
                const relatedSource_title2 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const Recommendation2 = await Recommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Recommendation2?.setSource_title)
                {
                    await
                    Recommendation2.
                    setSource_title(relatedSource_title2);
                }
            
                const relatedSource_title3 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const Recommendation3 = await Recommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Recommendation3?.setSource_title)
                {
                    await
                    Recommendation3.
                    setSource_title(relatedSource_title3);
                }
            
                const relatedSource_title4 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const Recommendation4 = await Recommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Recommendation4?.setSource_title)
                {
                    await
                    Recommendation4.
                    setSource_title(relatedSource_title4);
                }
            
        }
        
    
        
            
            async function associateRecommendationWithRecommended_title() {
            
                const relatedRecommended_title0 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const Recommendation0 = await Recommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Recommendation0?.setRecommended_title)
                {
                    await
                    Recommendation0.
                    setRecommended_title(relatedRecommended_title0);
                }
            
                const relatedRecommended_title1 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const Recommendation1 = await Recommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Recommendation1?.setRecommended_title)
                {
                    await
                    Recommendation1.
                    setRecommended_title(relatedRecommended_title1);
                }
            
                const relatedRecommended_title2 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const Recommendation2 = await Recommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Recommendation2?.setRecommended_title)
                {
                    await
                    Recommendation2.
                    setRecommended_title(relatedRecommended_title2);
                }
            
                const relatedRecommended_title3 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const Recommendation3 = await Recommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Recommendation3?.setRecommended_title)
                {
                    await
                    Recommendation3.
                    setRecommended_title(relatedRecommended_title3);
                }
            
                const relatedRecommended_title4 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const Recommendation4 = await Recommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Recommendation4?.setRecommended_title)
                {
                    await
                    Recommendation4.
                    setRecommended_title(relatedRecommended_title4);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateTrendingEntryWithTitle() {
            
                const relatedTitle0 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const TrendingEntry0 = await TrendingEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TrendingEntry0?.setTitle)
                {
                    await
                    TrendingEntry0.
                    setTitle(relatedTitle0);
                }
            
                const relatedTitle1 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const TrendingEntry1 = await TrendingEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TrendingEntry1?.setTitle)
                {
                    await
                    TrendingEntry1.
                    setTitle(relatedTitle1);
                }
            
                const relatedTitle2 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const TrendingEntry2 = await TrendingEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TrendingEntry2?.setTitle)
                {
                    await
                    TrendingEntry2.
                    setTitle(relatedTitle2);
                }
            
                const relatedTitle3 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const TrendingEntry3 = await TrendingEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (TrendingEntry3?.setTitle)
                {
                    await
                    TrendingEntry3.
                    setTitle(relatedTitle3);
                }
            
                const relatedTitle4 = await Titles.findOne({
                    offset: Math.floor(Math.random() * (await Titles.count())),
                });
                const TrendingEntry4 = await TrendingEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (TrendingEntry4?.setTitle)
                {
                    await
                    TrendingEntry4.
                    setTitle(relatedTitle4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Titles.bulkCreate(TitlesData);
                
            
            
                
                await Genres.bulkCreate(GenresData);
                
            
            
                
                await TitleGenres.bulkCreate(TitleGenresData);
                
            
            
                
                await People.bulkCreate(PeopleData);
                
            
            
                
                await TitleCast.bulkCreate(TitleCastData);
                
            
            
                
                await TitleCrew.bulkCreate(TitleCrewData);
                
            
            
                
                await Videos.bulkCreate(VideosData);
                
            
            
                
                await Watchlists.bulkCreate(WatchlistsData);
                
            
            
                
                await WatchlistItems.bulkCreate(WatchlistItemsData);
                
            
            
                
                await UserRatings.bulkCreate(UserRatingsData);
                
            
            
                
                await Recommendations.bulkCreate(RecommendationsData);
                
            
            
                
                await TrendingEntries.bulkCreate(TrendingEntriesData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateTitleGenreWithTitle(),
                    
                
                    
                        
                        await associateTitleGenreWithGenre(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateTitleCastWithTitle(),
                    
                
                    
                        
                        await associateTitleCastWithPerson(),
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateTitleCrewWithTitle(),
                    
                
                    
                        
                        await associateTitleCrewWithPerson(),
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateVideoWithTitle(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateWatchlistWithUser(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateWatchlistItemWithWatchlist(),
                    
                
                    
                        
                        await associateWatchlistItemWithTitle(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateUserRatingWithUser(),
                    
                
                    
                        
                        await associateUserRatingWithTitle(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateRecommendationWithUser(),
                    
                
                    
                        
                        await associateRecommendationWithSource_title(),
                    
                
                    
                        
                        await associateRecommendationWithRecommended_title(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateTrendingEntryWithTitle(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('titles', null, {});
            
            
            await queryInterface.bulkDelete('genres', null, {});
            
            
            await queryInterface.bulkDelete('title_genres', null, {});
            
            
            await queryInterface.bulkDelete('people', null, {});
            
            
            await queryInterface.bulkDelete('title_cast', null, {});
            
            
            await queryInterface.bulkDelete('title_crew', null, {});
            
            
            await queryInterface.bulkDelete('videos', null, {});
            
            
            await queryInterface.bulkDelete('watchlists', null, {});
            
            
            await queryInterface.bulkDelete('watchlist_items', null, {});
            
            
            await queryInterface.bulkDelete('user_ratings', null, {});
            
            
            await queryInterface.bulkDelete('recommendations', null, {});
            
            
            await queryInterface.bulkDelete('trending_entries', null, {});
            
        
    },
};