





















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






const Organizations = db.organizations;

const Projects = db.projects;

const Pages = db.pages;

const Components = db.components;

const Layers = db.layers;

const Assets = db.assets;

const Versions = db.versions;

const Builds = db.builds;

const Styles = db.styles;

const Teams = db.teams;







const OrganizationsData = [
    
    {
    
        
        
            
                "name": "BrightWave Studio",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Maple Interactive",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Nimbus Collective",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Copperline Labs",
            
        
    
    },
    
];



const ProjectsData = [
    
    {
    
        
        
            
                "name": "Marketing Microsite",
            
        
    
        
        
            
                "description": "A lightweight site focused on lead capture and performance",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                "status": "archived",
            
        
    
        
        
            
                "visibility": "public",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Design System",
            
        
    
        
        
            
                "description": "Shared components and tokens for product teams",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "visibility": "private",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Campaign Landing",
            
        
    
        
        
            
                "description": "Short lived landing page for Q3 campaign",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "visibility": "public",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Client Portfolio",
            
        
    
        
        
            
                "description": "Showcase site of recent client work",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                "status": "archived",
            
        
    
        
        
            
                "visibility": "private",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PagesData = [
    
    {
    
        
        
            
                "title": "Home",
            
        
    
        
        
            
                "slug": "home",
            
        
    
        
        
            
                "path": "/",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "published": true,
            
        
    
        
        
            
                "publish_start": new Date('2025-01-15T09:00:00Z'),
            
        
    
        
        
            
                "publish_end": new Date('2026-01-15T09:00:00Z'),
            
        
    
        
        
            
                "seo_description": "High conversion marketing home page",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "title": "Components Overview",
            
        
    
        
        
            
                "slug": "components",
            
        
    
        
        
            
                "path": "/components",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "published": true,
            
        
    
        
        
            
                "publish_start": new Date('2024-11-01T08:00:00Z'),
            
        
    
        
        
            
                "publish_end": new Date('2030-01-01T00:00:00Z'),
            
        
    
        
        
            
                "seo_description": "Design system components and usage examples",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "title": "Campaign Splash",
            
        
    
        
        
            
                "slug": "campaign",
            
        
    
        
        
            
                "path": "/campaign",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "published": false,
            
        
    
        
        
            
                "publish_start": new Date('2025-06-01T00:00:00Z'),
            
        
    
        
        
            
                "publish_end": new Date('2025-07-01T00:00:00Z'),
            
        
    
        
        
            
                "seo_description": "Limited time campaign landing page",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "title": "Portfolio",
            
        
    
        
        
            
                "slug": "portfolio",
            
        
    
        
        
            
                "path": "/portfolio",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "published": true,
            
        
    
        
        
            
                "publish_start": new Date('2023-05-01T00:00:00Z'),
            
        
    
        
        
            
                "publish_end": new Date('2028-05-01T00:00:00Z'),
            
        
    
        
        
            
                "seo_description": "Selected case studies and visuals",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ComponentsData = [
    
    {
    
        
        
            
                "name": "Primary Button",
            
        
    
        
        
            
                "component_type": "layout",
            
        
    
        
        
            
                "props": "{label:Get started,variant:primary}",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_public": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Hero Section",
            
        
    
        
        
            
                "component_type": "composite",
            
        
    
        
        
            
                "props": "{heading:Grow with us,cta:Request demo}",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_public": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Card",
            
        
    
        
        
            
                "component_type": "layout",
            
        
    
        
        
            
                "props": "{title:Card title,image:null}",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_public": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Grid Layout",
            
        
    
        
        
            
                "component_type": "composite",
            
        
    
        
        
            
                "props": "{columns:3,gap:24}",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_public": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const LayersData = [
    
    {
    
        
        
            
                "name": "Hero Frame",
            
        
    
        
        
            
                "layer_type": "group",
            
        
    
        
        
            
                "props": "{width:100%,height:480}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order": 1,
            
        
    
        
        
            
                "visible": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Headline Text",
            
        
    
        
        
            
                "layer_type": "frame",
            
        
    
        
        
            
                "props": "{text:Welcome to our product,fontSize:36}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order": 2,
            
        
    
        
        
            
                "visible": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Hero Image",
            
        
    
        
        
            
                "layer_type": "group",
            
        
    
        
        
            
                "props": "{src:/assets/hero.png,fit:cover}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order": 3,
            
        
    
        
        
            
                "visible": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "CTA Button",
            
        
    
        
        
            
                "layer_type": "group",
            
        
    
        
        
            
                "props": "{label:Get started,action:/signup}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order": 4,
            
        
    
        
        
            
                "visible": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const AssetsData = [
    
    {
    
        
        
            
                "name": "Hero Illustration",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "kind": "font",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "size": 512.5,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Brand Font",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "kind": "image",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "size": 64.2,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Product Video",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "kind": "other",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "size": 20480.0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Logo",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "kind": "other",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "size": 12.4,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const VersionsData = [
    
    {
    
        
        
            
                "version": "1.0.0",
            
        
    
        
        
            
                "notes": "Initial release of home page",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "created_on": new Date('2024-12-01T12:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "version": "1.1.0",
            
        
    
        
        
            
                "notes": "Updated hero layout and CTA copy",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "created_on": new Date('2025-01-10T09:30:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "version": "0.1.0",
            
        
    
        
        
            
                "notes": "Draft components collection",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "created_on": new Date('2024-11-05T15:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "version": "2025-06-campaign",
            
        
    
        
        
            
                "notes": "Campaign landing early draft",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "created_on": new Date('2025-05-20T08:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const BuildsData = [
    
    {
    
        
        
            
                "name": "Home Production Build",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                "url": "https://marketing.example.com",
            
        
    
        
        
            
                "created_on": new Date('2025-01-15T10:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Components Preview",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                "url": "https://preview.example.com/components",
            
        
    
        
        
            
                "created_on": new Date('2025-01-12T14:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Campaign Staging",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "building",
            
        
    
        
        
            
                "url": "",
            
        
    
        
        
            
                "created_on": new Date('2025-05-25T07:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Portfolio Live",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "pending",
            
        
    
        
        
            
                "url": "https://portfolio.example.com",
            
        
    
        
        
            
                "created_on": new Date('2024-05-01T08:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const StylesData = [
    
    {
    
        
        
            
                "name": "Primary Color",
            
        
    
        
        
            
                "token_type": "typography",
            
        
    
        
        
            
                "value": "#0f62fe",
            
        
    
        
        
            
                "description": "Brand primary blue used for CTAs and links",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Base Spacing",
            
        
    
        
        
            
                "token_type": "spacing",
            
        
    
        
        
            
                "value": "8",
            
        
    
        
        
            
                "description": "Base spacing unit in pixels",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Heading Font",
            
        
    
        
        
            
                "token_type": "typography",
            
        
    
        
        
            
                "value": "Inter 700 28px",
            
        
    
        
        
            
                "description": "Primary heading typography token",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Card Shadow",
            
        
    
        
        
            
                "token_type": "shadow",
            
        
    
        
        
            
                "value": "0 4px 12px rgba(16,24,40,0.08)",
            
        
    
        
        
            
                "description": "Elevated card shadow",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const TeamsData = [
    
    {
    
        
        
            
                "name": "Product Design",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Growth",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Platform",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Client Services",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];




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

    
    
    
    
    
        
    

    
    
    
        
    
        
    
        
            
            async function associateProjectWithOwner() {
            
                const relatedOwner0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Project0 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Project0?.setOwner)
                {
                    await
                    Project0.
                    setOwner(relatedOwner0);
                }
            
                const relatedOwner1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Project1 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Project1?.setOwner)
                {
                    await
                    Project1.
                    setOwner(relatedOwner1);
                }
            
                const relatedOwner2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Project2 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Project2?.setOwner)
                {
                    await
                    Project2.
                    setOwner(relatedOwner2);
                }
            
                const relatedOwner3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Project3 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Project3?.setOwner)
                {
                    await
                    Project3.
                    setOwner(relatedOwner3);
                }
            
        }
        
    
        
            // Similar logic for "relation_many"
        
    
        
    
        
    
        
            
            async function associateProjectWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Project0 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Project0?.setOrganization)
                {
                    await
                    Project0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Project1 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Project1?.setOrganization)
                {
                    await
                    Project1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Project2 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Project2?.setOrganization)
                {
                    await
                    Project2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Project3 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Project3?.setOrganization)
                {
                    await
                    Project3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
            
            async function associatePageWithProject() {
            
                const relatedProject0 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Page0 = await Pages.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Page0?.setProject)
                {
                    await
                    Page0.
                    setProject(relatedProject0);
                }
            
                const relatedProject1 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Page1 = await Pages.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Page1?.setProject)
                {
                    await
                    Page1.
                    setProject(relatedProject1);
                }
            
                const relatedProject2 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Page2 = await Pages.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Page2?.setProject)
                {
                    await
                    Page2.
                    setProject(relatedProject2);
                }
            
                const relatedProject3 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Page3 = await Pages.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Page3?.setProject)
                {
                    await
                    Page3.
                    setProject(relatedProject3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePageWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Page0 = await Pages.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Page0?.setOrganization)
                {
                    await
                    Page0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Page1 = await Pages.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Page1?.setOrganization)
                {
                    await
                    Page1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Page2 = await Pages.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Page2?.setOrganization)
                {
                    await
                    Page2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Page3 = await Pages.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Page3?.setOrganization)
                {
                    await
                    Page3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
            
            async function associateComponentWithOwner() {
            
                const relatedOwner0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Component0 = await Components.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Component0?.setOwner)
                {
                    await
                    Component0.
                    setOwner(relatedOwner0);
                }
            
                const relatedOwner1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Component1 = await Components.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Component1?.setOwner)
                {
                    await
                    Component1.
                    setOwner(relatedOwner1);
                }
            
                const relatedOwner2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Component2 = await Components.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Component2?.setOwner)
                {
                    await
                    Component2.
                    setOwner(relatedOwner2);
                }
            
                const relatedOwner3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Component3 = await Components.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Component3?.setOwner)
                {
                    await
                    Component3.
                    setOwner(relatedOwner3);
                }
            
        }
        
    
        
    
        
            
            async function associateComponentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Component0 = await Components.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Component0?.setOrganization)
                {
                    await
                    Component0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Component1 = await Components.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Component1?.setOrganization)
                {
                    await
                    Component1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Component2 = await Components.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Component2?.setOrganization)
                {
                    await
                    Component2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Component3 = await Components.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Component3?.setOrganization)
                {
                    await
                    Component3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
            
            async function associateLayerWithPage() {
            
                const relatedPage0 = await Pages.findOne({
                    offset: Math.floor(Math.random() * (await Pages.count())),
                });
                const Layer0 = await Layers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Layer0?.setPage)
                {
                    await
                    Layer0.
                    setPage(relatedPage0);
                }
            
                const relatedPage1 = await Pages.findOne({
                    offset: Math.floor(Math.random() * (await Pages.count())),
                });
                const Layer1 = await Layers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Layer1?.setPage)
                {
                    await
                    Layer1.
                    setPage(relatedPage1);
                }
            
                const relatedPage2 = await Pages.findOne({
                    offset: Math.floor(Math.random() * (await Pages.count())),
                });
                const Layer2 = await Layers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Layer2?.setPage)
                {
                    await
                    Layer2.
                    setPage(relatedPage2);
                }
            
                const relatedPage3 = await Pages.findOne({
                    offset: Math.floor(Math.random() * (await Pages.count())),
                });
                const Layer3 = await Layers.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Layer3?.setPage)
                {
                    await
                    Layer3.
                    setPage(relatedPage3);
                }
            
        }
        
    
        
            
            async function associateLayerWithParent() {
            
                const relatedParent0 = await Layers.findOne({
                    offset: Math.floor(Math.random() * (await Layers.count())),
                });
                const Layer0 = await Layers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Layer0?.setParent)
                {
                    await
                    Layer0.
                    setParent(relatedParent0);
                }
            
                const relatedParent1 = await Layers.findOne({
                    offset: Math.floor(Math.random() * (await Layers.count())),
                });
                const Layer1 = await Layers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Layer1?.setParent)
                {
                    await
                    Layer1.
                    setParent(relatedParent1);
                }
            
                const relatedParent2 = await Layers.findOne({
                    offset: Math.floor(Math.random() * (await Layers.count())),
                });
                const Layer2 = await Layers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Layer2?.setParent)
                {
                    await
                    Layer2.
                    setParent(relatedParent2);
                }
            
                const relatedParent3 = await Layers.findOne({
                    offset: Math.floor(Math.random() * (await Layers.count())),
                });
                const Layer3 = await Layers.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Layer3?.setParent)
                {
                    await
                    Layer3.
                    setParent(relatedParent3);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateLayerWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Layer0 = await Layers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Layer0?.setOrganization)
                {
                    await
                    Layer0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Layer1 = await Layers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Layer1?.setOrganization)
                {
                    await
                    Layer1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Layer2 = await Layers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Layer2?.setOrganization)
                {
                    await
                    Layer2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Layer3 = await Layers.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Layer3?.setOrganization)
                {
                    await
                    Layer3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
            
            async function associateAssetWithUploaded_by() {
            
                const relatedUploaded_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Asset0 = await Assets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Asset0?.setUploaded_by)
                {
                    await
                    Asset0.
                    setUploaded_by(relatedUploaded_by0);
                }
            
                const relatedUploaded_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Asset1 = await Assets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Asset1?.setUploaded_by)
                {
                    await
                    Asset1.
                    setUploaded_by(relatedUploaded_by1);
                }
            
                const relatedUploaded_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Asset2 = await Assets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Asset2?.setUploaded_by)
                {
                    await
                    Asset2.
                    setUploaded_by(relatedUploaded_by2);
                }
            
                const relatedUploaded_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Asset3 = await Assets.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Asset3?.setUploaded_by)
                {
                    await
                    Asset3.
                    setUploaded_by(relatedUploaded_by3);
                }
            
        }
        
    
        
    
        
            
            async function associateAssetWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Asset0 = await Assets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Asset0?.setOrganization)
                {
                    await
                    Asset0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Asset1 = await Assets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Asset1?.setOrganization)
                {
                    await
                    Asset1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Asset2 = await Assets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Asset2?.setOrganization)
                {
                    await
                    Asset2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Asset3 = await Assets.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Asset3?.setOrganization)
                {
                    await
                    Asset3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
            
            async function associateVersionWithPage() {
            
                const relatedPage0 = await Pages.findOne({
                    offset: Math.floor(Math.random() * (await Pages.count())),
                });
                const Version0 = await Versions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Version0?.setPage)
                {
                    await
                    Version0.
                    setPage(relatedPage0);
                }
            
                const relatedPage1 = await Pages.findOne({
                    offset: Math.floor(Math.random() * (await Pages.count())),
                });
                const Version1 = await Versions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Version1?.setPage)
                {
                    await
                    Version1.
                    setPage(relatedPage1);
                }
            
                const relatedPage2 = await Pages.findOne({
                    offset: Math.floor(Math.random() * (await Pages.count())),
                });
                const Version2 = await Versions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Version2?.setPage)
                {
                    await
                    Version2.
                    setPage(relatedPage2);
                }
            
                const relatedPage3 = await Pages.findOne({
                    offset: Math.floor(Math.random() * (await Pages.count())),
                });
                const Version3 = await Versions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Version3?.setPage)
                {
                    await
                    Version3.
                    setPage(relatedPage3);
                }
            
        }
        
    
        
            
            async function associateVersionWithAuthor() {
            
                const relatedAuthor0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Version0 = await Versions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Version0?.setAuthor)
                {
                    await
                    Version0.
                    setAuthor(relatedAuthor0);
                }
            
                const relatedAuthor1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Version1 = await Versions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Version1?.setAuthor)
                {
                    await
                    Version1.
                    setAuthor(relatedAuthor1);
                }
            
                const relatedAuthor2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Version2 = await Versions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Version2?.setAuthor)
                {
                    await
                    Version2.
                    setAuthor(relatedAuthor2);
                }
            
                const relatedAuthor3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Version3 = await Versions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Version3?.setAuthor)
                {
                    await
                    Version3.
                    setAuthor(relatedAuthor3);
                }
            
        }
        
    
        
    
        
            
            async function associateVersionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Version0 = await Versions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Version0?.setOrganization)
                {
                    await
                    Version0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Version1 = await Versions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Version1?.setOrganization)
                {
                    await
                    Version1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Version2 = await Versions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Version2?.setOrganization)
                {
                    await
                    Version2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Version3 = await Versions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Version3?.setOrganization)
                {
                    await
                    Version3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
            
            async function associateBuildWithPage() {
            
                const relatedPage0 = await Pages.findOne({
                    offset: Math.floor(Math.random() * (await Pages.count())),
                });
                const Build0 = await Builds.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Build0?.setPage)
                {
                    await
                    Build0.
                    setPage(relatedPage0);
                }
            
                const relatedPage1 = await Pages.findOne({
                    offset: Math.floor(Math.random() * (await Pages.count())),
                });
                const Build1 = await Builds.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Build1?.setPage)
                {
                    await
                    Build1.
                    setPage(relatedPage1);
                }
            
                const relatedPage2 = await Pages.findOne({
                    offset: Math.floor(Math.random() * (await Pages.count())),
                });
                const Build2 = await Builds.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Build2?.setPage)
                {
                    await
                    Build2.
                    setPage(relatedPage2);
                }
            
                const relatedPage3 = await Pages.findOne({
                    offset: Math.floor(Math.random() * (await Pages.count())),
                });
                const Build3 = await Builds.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Build3?.setPage)
                {
                    await
                    Build3.
                    setPage(relatedPage3);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateBuildWithAuthor() {
            
                const relatedAuthor0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Build0 = await Builds.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Build0?.setAuthor)
                {
                    await
                    Build0.
                    setAuthor(relatedAuthor0);
                }
            
                const relatedAuthor1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Build1 = await Builds.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Build1?.setAuthor)
                {
                    await
                    Build1.
                    setAuthor(relatedAuthor1);
                }
            
                const relatedAuthor2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Build2 = await Builds.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Build2?.setAuthor)
                {
                    await
                    Build2.
                    setAuthor(relatedAuthor2);
                }
            
                const relatedAuthor3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Build3 = await Builds.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Build3?.setAuthor)
                {
                    await
                    Build3.
                    setAuthor(relatedAuthor3);
                }
            
        }
        
    
        
            
            async function associateBuildWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Build0 = await Builds.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Build0?.setOrganization)
                {
                    await
                    Build0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Build1 = await Builds.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Build1?.setOrganization)
                {
                    await
                    Build1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Build2 = await Builds.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Build2?.setOrganization)
                {
                    await
                    Build2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Build3 = await Builds.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Build3?.setOrganization)
                {
                    await
                    Build3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
            
            async function associateStyleWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Style0 = await Styles.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Style0?.setOrganization)
                {
                    await
                    Style0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Style1 = await Styles.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Style1?.setOrganization)
                {
                    await
                    Style1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Style2 = await Styles.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Style2?.setOrganization)
                {
                    await
                    Style2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Style3 = await Styles.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Style3?.setOrganization)
                {
                    await
                    Style3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateTeamWithOwner() {
            
                const relatedOwner0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Team0 = await Teams.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Team0?.setOwner)
                {
                    await
                    Team0.
                    setOwner(relatedOwner0);
                }
            
                const relatedOwner1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Team1 = await Teams.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Team1?.setOwner)
                {
                    await
                    Team1.
                    setOwner(relatedOwner1);
                }
            
                const relatedOwner2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Team2 = await Teams.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Team2?.setOwner)
                {
                    await
                    Team2.
                    setOwner(relatedOwner2);
                }
            
                const relatedOwner3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Team3 = await Teams.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Team3?.setOwner)
                {
                    await
                    Team3.
                    setOwner(relatedOwner3);
                }
            
        }
        
    
        
            
            async function associateTeamWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Team0 = await Teams.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Team0?.setOrganization)
                {
                    await
                    Team0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Team1 = await Teams.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Team1?.setOrganization)
                {
                    await
                    Team1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Team2 = await Teams.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Team2?.setOrganization)
                {
                    await
                    Team2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Team3 = await Teams.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Team3?.setOrganization)
                {
                    await
                    Team3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Organizations.bulkCreate(OrganizationsData);
                
            
            
                
                await Projects.bulkCreate(ProjectsData);
                
            
            
                
                await Pages.bulkCreate(PagesData);
                
            
            
                
                await Components.bulkCreate(ComponentsData);
                
            
            
                
                await Layers.bulkCreate(LayersData);
                
            
            
                
                await Assets.bulkCreate(AssetsData);
                
            
            
                
                await Versions.bulkCreate(VersionsData);
                
            
            
                
                await Builds.bulkCreate(BuildsData);
                
            
            
                
                await Styles.bulkCreate(StylesData);
                
            
            
                
                await Teams.bulkCreate(TeamsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateUserWithOrganization(),
                    
                
            
                
                
                
                
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateProjectWithOwner(),
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                
                    
                
                    
                        
                        await associateProjectWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePageWithProject(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePageWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateComponentWithOwner(),
                    
                
                    
                
                    
                        
                        await associateComponentWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                        
                        await associateLayerWithPage(),
                    
                
                    
                        
                        await associateLayerWithParent(),
                    
                
                    
                
                    
                
                    
                        
                        await associateLayerWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                        
                        await associateAssetWithUploaded_by(),
                    
                
                    
                
                    
                        
                        await associateAssetWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateVersionWithPage(),
                    
                
                    
                        
                        await associateVersionWithAuthor(),
                    
                
                    
                
                    
                        
                        await associateVersionWithOrganization(),
                    
                
            
                
                
                    
                
                    
                        
                        await associateBuildWithPage(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateBuildWithAuthor(),
                    
                
                    
                        
                        await associateBuildWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateStyleWithOrganization(),
                    
                
            
                
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateTeamWithOwner(),
                    
                
                    
                        
                        await associateTeamWithOrganization(),
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('organizations', null, {});
            
            
            await queryInterface.bulkDelete('projects', null, {});
            
            
            await queryInterface.bulkDelete('pages', null, {});
            
            
            await queryInterface.bulkDelete('components', null, {});
            
            
            await queryInterface.bulkDelete('layers', null, {});
            
            
            await queryInterface.bulkDelete('assets', null, {});
            
            
            await queryInterface.bulkDelete('versions', null, {});
            
            
            await queryInterface.bulkDelete('builds', null, {});
            
            
            await queryInterface.bulkDelete('styles', null, {});
            
            
            await queryInterface.bulkDelete('teams', null, {});
            
        
    },
};