





















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






const Organizations = db.organizations;

const Tenants = db.tenants;

const Locations = db.locations;

const RolePermissions = db.role_permissions;

const TenantMemberships = db.tenant_memberships;

const Customers = db.customers;

const Products = db.products;

const ProductVariants = db.product_variants;

const TaxRates = db.tax_rates;

const Discounts = db.discounts;

const Registers = db.registers;

const Shifts = db.shifts;

const Carts = db.carts;

const CartItems = db.cart_items;

const Orders = db.orders;

const OrderItems = db.order_items;

const PaymentIntents = db.payment_intents;

const Payments = db.payments;

const Refunds = db.refunds;

const InventoryItems = db.inventory_items;

const InventoryAdjustments = db.inventory_adjustments;

const Partners = db.partners;

const TenantPartnerships = db.tenant_partnerships;

const Payouts = db.payouts;

const HelcimConfigurations = db.helcim_configurations;

const Reports = db.reports;

const AuditEvents = db.audit_events;







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



const TenantsData = [
    
    {
    
        
        
            
                "tenant_name": "Marie Curie",
            
        
    
        
        
            
                "legal_name": "Marie Curie",
            
        
    
        
        
            
                "slug": "Grace Hopper",
            
        
    
        
        
            
                "primary_email": "Grace Hopper",
            
        
    
        
        
            
                "primary_phone": "Marie Curie",
            
        
    
        
        
            
                "time_zone": "Grace Hopper",
            
        
    
        
        
            
                "currency_code": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "tenant_name": "Ada Lovelace",
            
        
    
        
        
            
                "legal_name": "Alan Turing",
            
        
    
        
        
            
                "slug": "Ada Lovelace",
            
        
    
        
        
            
                "primary_email": "Alan Turing",
            
        
    
        
        
            
                "primary_phone": "Alan Turing",
            
        
    
        
        
            
                "time_zone": "Ada Lovelace",
            
        
    
        
        
            
                "currency_code": "Marie Curie",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "tenant_name": "Alan Turing",
            
        
    
        
        
            
                "legal_name": "Grace Hopper",
            
        
    
        
        
            
                "slug": "Alan Turing",
            
        
    
        
        
            
                "primary_email": "Marie Curie",
            
        
    
        
        
            
                "primary_phone": "Alan Turing",
            
        
    
        
        
            
                "time_zone": "Ada Lovelace",
            
        
    
        
        
            
                "currency_code": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const LocationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "location_name": "Grace Hopper",
            
        
    
        
        
            
                "address_line_1": "Ada Lovelace",
            
        
    
        
        
            
                "address_line_2": "Marie Curie",
            
        
    
        
        
            
                "city": "Grace Hopper",
            
        
    
        
        
            
                "region": "Alan Turing",
            
        
    
        
        
            
                "postal_code": "Marie Curie",
            
        
    
        
        
            
                "country": "Ada Lovelace",
            
        
    
        
        
            
                "phone": "Grace Hopper",
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "location_name": "Grace Hopper",
            
        
    
        
        
            
                "address_line_1": "Marie Curie",
            
        
    
        
        
            
                "address_line_2": "Ada Lovelace",
            
        
    
        
        
            
                "city": "Alan Turing",
            
        
    
        
        
            
                "region": "Alan Turing",
            
        
    
        
        
            
                "postal_code": "Alan Turing",
            
        
    
        
        
            
                "country": "Grace Hopper",
            
        
    
        
        
            
                "phone": "Grace Hopper",
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "location_name": "Marie Curie",
            
        
    
        
        
            
                "address_line_1": "Grace Hopper",
            
        
    
        
        
            
                "address_line_2": "Alan Turing",
            
        
    
        
        
            
                "city": "Marie Curie",
            
        
    
        
        
            
                "region": "Grace Hopper",
            
        
    
        
        
            
                "postal_code": "Alan Turing",
            
        
    
        
        
            
                "country": "Ada Lovelace",
            
        
    
        
        
            
                "phone": "Ada Lovelace",
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const RolePermissionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_allowed": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_allowed": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_allowed": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const TenantMembershipsData = [
    
    {
    
        
        
            
                // 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_many" field
            
        
    
        
        
            
                "is_owner": true,
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                "joined_at": new Date(Date.now()),
            
        
    
        
        
            
                // 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_many" field
            
        
    
        
        
            
                "is_owner": true,
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                "joined_at": new Date(Date.now()),
            
        
    
        
        
            
                // 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_many" field
            
        
    
        
        
            
                "is_owner": true,
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                "joined_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CustomersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "customer_name": "Grace Hopper",
            
        
    
        
        
            
                "email": "Marie Curie",
            
        
    
        
        
            
                "phone": "Grace Hopper",
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "customer_name": "Alan Turing",
            
        
    
        
        
            
                "email": "Marie Curie",
            
        
    
        
        
            
                "phone": "Grace Hopper",
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "customer_name": "Marie Curie",
            
        
    
        
        
            
                "email": "Ada Lovelace",
            
        
    
        
        
            
                "phone": "Grace Hopper",
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ProductsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "product_name": "Marie Curie",
            
        
    
        
        
            
                "sku": "Alan Turing",
            
        
    
        
        
            
                "barcode": "Alan Turing",
            
        
    
        
        
            
                "product_type": "physical",
            
        
    
        
        
            
                "price": 0.2,
            
        
    
        
        
            
                "cost": 5.19,
            
        
    
        
        
            
                "is_taxable": true,
            
        
    
        
        
            
                "track_inventory": true,
            
        
    
        
        
            
                "description": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "product_name": "Marie Curie",
            
        
    
        
        
            
                "sku": "Alan Turing",
            
        
    
        
        
            
                "barcode": "Marie Curie",
            
        
    
        
        
            
                "product_type": "digital",
            
        
    
        
        
            
                "price": 6.0,
            
        
    
        
        
            
                "cost": 6.53,
            
        
    
        
        
            
                "is_taxable": true,
            
        
    
        
        
            
                "track_inventory": true,
            
        
    
        
        
            
                "description": "Marie Curie",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "product_name": "Alan Turing",
            
        
    
        
        
            
                "sku": "Grace Hopper",
            
        
    
        
        
            
                "barcode": "Grace Hopper",
            
        
    
        
        
            
                "product_type": "physical",
            
        
    
        
        
            
                "price": 0.61,
            
        
    
        
        
            
                "cost": 3.38,
            
        
    
        
        
            
                "is_taxable": true,
            
        
    
        
        
            
                "track_inventory": false,
            
        
    
        
        
            
                "description": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ProductVariantsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "variant_name": "Ada Lovelace",
            
        
    
        
        
            
                "sku": "Ada Lovelace",
            
        
    
        
        
            
                "barcode": "Marie Curie",
            
        
    
        
        
            
                "price_override": 3.93,
            
        
    
        
        
            
                "cost_override": 8.31,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "variant_name": "Grace Hopper",
            
        
    
        
        
            
                "sku": "Grace Hopper",
            
        
    
        
        
            
                "barcode": "Marie Curie",
            
        
    
        
        
            
                "price_override": 3.09,
            
        
    
        
        
            
                "cost_override": 2.2,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "variant_name": "Grace Hopper",
            
        
    
        
        
            
                "sku": "Alan Turing",
            
        
    
        
        
            
                "barcode": "Alan Turing",
            
        
    
        
        
            
                "price_override": 3.33,
            
        
    
        
        
            
                "cost_override": 0.79,
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const TaxRatesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "tax_name": "Marie Curie",
            
        
    
        
        
            
                "rate_percent": 0.89,
            
        
    
        
        
            
                "is_compound": true,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "tax_name": "Ada Lovelace",
            
        
    
        
        
            
                "rate_percent": 4.29,
            
        
    
        
        
            
                "is_compound": true,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "tax_name": "Marie Curie",
            
        
    
        
        
            
                "rate_percent": 4.66,
            
        
    
        
        
            
                "is_compound": false,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const DiscountsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "discount_name": "Alan Turing",
            
        
    
        
        
            
                "discount_type": "amount",
            
        
    
        
        
            
                "value": 1.27,
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "discount_name": "Ada Lovelace",
            
        
    
        
        
            
                "discount_type": "percent",
            
        
    
        
        
            
                "value": 9.67,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "discount_name": "Marie Curie",
            
        
    
        
        
            
                "discount_type": "amount",
            
        
    
        
        
            
                "value": 5.34,
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const RegistersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "register_name": "Marie Curie",
            
        
    
        
        
            
                "device_label": "Alan Turing",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "register_name": "Ada Lovelace",
            
        
    
        
        
            
                "device_label": "Marie Curie",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "register_name": "Ada Lovelace",
            
        
    
        
        
            
                "device_label": "Alan Turing",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ShiftsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "opened_at": new Date(Date.now()),
            
        
    
        
        
            
                "closed_at": new Date(Date.now()),
            
        
    
        
        
            
                "opening_cash_amount": 7.29,
            
        
    
        
        
            
                "closing_cash_amount": 3.94,
            
        
    
        
        
            
                "expected_cash_amount": 0.09,
            
        
    
        
        
            
                "cash_variance_amount": 7.91,
            
        
    
        
        
            
                "shift_status": "open",
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "opened_at": new Date(Date.now()),
            
        
    
        
        
            
                "closed_at": new Date(Date.now()),
            
        
    
        
        
            
                "opening_cash_amount": 6.89,
            
        
    
        
        
            
                "closing_cash_amount": 4.79,
            
        
    
        
        
            
                "expected_cash_amount": 9.56,
            
        
    
        
        
            
                "cash_variance_amount": 2.08,
            
        
    
        
        
            
                "shift_status": "closed",
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "opened_at": new Date(Date.now()),
            
        
    
        
        
            
                "closed_at": new Date(Date.now()),
            
        
    
        
        
            
                "opening_cash_amount": 9.29,
            
        
    
        
        
            
                "closing_cash_amount": 8.55,
            
        
    
        
        
            
                "expected_cash_amount": 6.83,
            
        
    
        
        
            
                "cash_variance_amount": 2.83,
            
        
    
        
        
            
                "shift_status": "open",
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CartsData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "cart_status": "on_hold",
            
        
    
        
        
            
                "subtotal_amount": 1.13,
            
        
    
        
        
            
                "discount_amount": 2.91,
            
        
    
        
        
            
                "tax_amount": 4.99,
            
        
    
        
        
            
                "total_amount": 0.88,
            
        
    
        
        
            
                "hold_reason": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "cart_status": "on_hold",
            
        
    
        
        
            
                "subtotal_amount": 9.4,
            
        
    
        
        
            
                "discount_amount": 4.46,
            
        
    
        
        
            
                "tax_amount": 5.51,
            
        
    
        
        
            
                "total_amount": 3.27,
            
        
    
        
        
            
                "hold_reason": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "cart_status": "converted",
            
        
    
        
        
            
                "subtotal_amount": 5.54,
            
        
    
        
        
            
                "discount_amount": 7.58,
            
        
    
        
        
            
                "tax_amount": 5.4,
            
        
    
        
        
            
                "total_amount": 4.35,
            
        
    
        
        
            
                "hold_reason": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CartItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "item_name": "Ada Lovelace",
            
        
    
        
        
            
                "unit_price": 4.14,
            
        
    
        
        
            
                "quantity": 7.19,
            
        
    
        
        
            
                "line_discount_amount": 2.7,
            
        
    
        
        
            
                "line_tax_amount": 5.95,
            
        
    
        
        
            
                "line_total_amount": 2.69,
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "item_name": "Alan Turing",
            
        
    
        
        
            
                "unit_price": 0.17,
            
        
    
        
        
            
                "quantity": 8.65,
            
        
    
        
        
            
                "line_discount_amount": 2.76,
            
        
    
        
        
            
                "line_tax_amount": 7.42,
            
        
    
        
        
            
                "line_total_amount": 8.99,
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "item_name": "Ada Lovelace",
            
        
    
        
        
            
                "unit_price": 6.66,
            
        
    
        
        
            
                "quantity": 7.96,
            
        
    
        
        
            
                "line_discount_amount": 3.63,
            
        
    
        
        
            
                "line_tax_amount": 7.36,
            
        
    
        
        
            
                "line_total_amount": 9.33,
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const OrdersData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "order_number": "Alan Turing",
            
        
    
        
        
            
                "order_status": "refunded",
            
        
    
        
        
            
                "placed_at": new Date(Date.now()),
            
        
    
        
        
            
                "subtotal_amount": 0.56,
            
        
    
        
        
            
                "discount_amount": 6.15,
            
        
    
        
        
            
                "tax_amount": 0.5,
            
        
    
        
        
            
                "tip_amount": 4.38,
            
        
    
        
        
            
                "total_amount": 10.0,
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order_number": "Ada Lovelace",
            
        
    
        
        
            
                "order_status": "refunded",
            
        
    
        
        
            
                "placed_at": new Date(Date.now()),
            
        
    
        
        
            
                "subtotal_amount": 3.63,
            
        
    
        
        
            
                "discount_amount": 4.23,
            
        
    
        
        
            
                "tax_amount": 6.46,
            
        
    
        
        
            
                "tip_amount": 2.28,
            
        
    
        
        
            
                "total_amount": 8.95,
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order_number": "Marie Curie",
            
        
    
        
        
            
                "order_status": "draft",
            
        
    
        
        
            
                "placed_at": new Date(Date.now()),
            
        
    
        
        
            
                "subtotal_amount": 7.1,
            
        
    
        
        
            
                "discount_amount": 1.7,
            
        
    
        
        
            
                "tax_amount": 1.8,
            
        
    
        
        
            
                "tip_amount": 6.39,
            
        
    
        
        
            
                "total_amount": 5.37,
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const OrderItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "item_name": "Grace Hopper",
            
        
    
        
        
            
                "unit_price": 4.13,
            
        
    
        
        
            
                "quantity": 9.07,
            
        
    
        
        
            
                "line_discount_amount": 4.79,
            
        
    
        
        
            
                "line_tax_amount": 8.94,
            
        
    
        
        
            
                "line_total_amount": 0.27,
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "item_name": "Marie Curie",
            
        
    
        
        
            
                "unit_price": 8.99,
            
        
    
        
        
            
                "quantity": 8.84,
            
        
    
        
        
            
                "line_discount_amount": 7.49,
            
        
    
        
        
            
                "line_tax_amount": 7.55,
            
        
    
        
        
            
                "line_total_amount": 8.21,
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "item_name": "Alan Turing",
            
        
    
        
        
            
                "unit_price": 0.38,
            
        
    
        
        
            
                "quantity": 7.68,
            
        
    
        
        
            
                "line_discount_amount": 7.13,
            
        
    
        
        
            
                "line_tax_amount": 8.44,
            
        
    
        
        
            
                "line_total_amount": 5.6,
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PaymentIntentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider": "helcim",
            
        
    
        
        
            
                "provider_reference": "Alan Turing",
            
        
    
        
        
            
                "amount": 4.01,
            
        
    
        
        
            
                "currency_code": "Alan Turing",
            
        
    
        
        
            
                "intent_status": "requires_payment",
            
        
    
        
        
            
                "initiated_at": new Date(Date.now()),
            
        
    
        
        
            
                "completed_at": new Date(Date.now()),
            
        
    
        
        
            
                "failure_message": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider": "helcim",
            
        
    
        
        
            
                "provider_reference": "Alan Turing",
            
        
    
        
        
            
                "amount": 7.96,
            
        
    
        
        
            
                "currency_code": "Alan Turing",
            
        
    
        
        
            
                "intent_status": "processing",
            
        
    
        
        
            
                "initiated_at": new Date(Date.now()),
            
        
    
        
        
            
                "completed_at": new Date(Date.now()),
            
        
    
        
        
            
                "failure_message": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider": "helcim",
            
        
    
        
        
            
                "provider_reference": "Alan Turing",
            
        
    
        
        
            
                "amount": 1.66,
            
        
    
        
        
            
                "currency_code": "Ada Lovelace",
            
        
    
        
        
            
                "intent_status": "succeeded",
            
        
    
        
        
            
                "initiated_at": new Date(Date.now()),
            
        
    
        
        
            
                "completed_at": new Date(Date.now()),
            
        
    
        
        
            
                "failure_message": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PaymentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "method": "gift_card",
            
        
    
        
        
            
                "amount": 6.73,
            
        
    
        
        
            
                "paid_at": new Date(Date.now()),
            
        
    
        
        
            
                "payment_status": "voided",
            
        
    
        
        
            
                "receipt_note": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "method": "card",
            
        
    
        
        
            
                "amount": 0.3,
            
        
    
        
        
            
                "paid_at": new Date(Date.now()),
            
        
    
        
        
            
                "payment_status": "failed",
            
        
    
        
        
            
                "receipt_note": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "method": "gift_card",
            
        
    
        
        
            
                "amount": 9.55,
            
        
    
        
        
            
                "paid_at": new Date(Date.now()),
            
        
    
        
        
            
                "payment_status": "voided",
            
        
    
        
        
            
                "receipt_note": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const RefundsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "refund_amount": 2.8,
            
        
    
        
        
            
                "refunded_at": new Date(Date.now()),
            
        
    
        
        
            
                "refund_status": "failed",
            
        
    
        
        
            
                "reason": "Alan Turing",
            
        
    
        
        
            
                "provider_reference": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "refund_amount": 3.68,
            
        
    
        
        
            
                "refunded_at": new Date(Date.now()),
            
        
    
        
        
            
                "refund_status": "pending",
            
        
    
        
        
            
                "reason": "Ada Lovelace",
            
        
    
        
        
            
                "provider_reference": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "refund_amount": 9.58,
            
        
    
        
        
            
                "refunded_at": new Date(Date.now()),
            
        
    
        
        
            
                "refund_status": "canceled",
            
        
    
        
        
            
                "reason": "Grace Hopper",
            
        
    
        
        
            
                "provider_reference": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InventoryItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "on_hand_quantity": 0.96,
            
        
    
        
        
            
                "reorder_point_quantity": 7.34,
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "on_hand_quantity": 0.58,
            
        
    
        
        
            
                "reorder_point_quantity": 6.5,
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "on_hand_quantity": 1.93,
            
        
    
        
        
            
                "reorder_point_quantity": 5.29,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InventoryAdjustmentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "adjusted_at": new Date(Date.now()),
            
        
    
        
        
            
                "adjustment_type": "correction",
            
        
    
        
        
            
                "quantity_delta": 9.95,
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "adjusted_at": new Date(Date.now()),
            
        
    
        
        
            
                "adjustment_type": "transfer",
            
        
    
        
        
            
                "quantity_delta": 0.57,
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "adjusted_at": new Date(Date.now()),
            
        
    
        
        
            
                "adjustment_type": "transfer",
            
        
    
        
        
            
                "quantity_delta": 7.98,
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PartnersData = [
    
    {
    
        
        
            
                "partner_name": "Grace Hopper",
            
        
    
        
        
            
                "partner_type": "reseller",
            
        
    
        
        
            
                "contact_email": "Marie Curie",
            
        
    
        
        
            
                "contact_phone": "Grace Hopper",
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "partner_name": "Alan Turing",
            
        
    
        
        
            
                "partner_type": "agency",
            
        
    
        
        
            
                "contact_email": "Marie Curie",
            
        
    
        
        
            
                "contact_phone": "Alan Turing",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "partner_name": "Ada Lovelace",
            
        
    
        
        
            
                "partner_type": "reseller",
            
        
    
        
        
            
                "contact_email": "Marie Curie",
            
        
    
        
        
            
                "contact_phone": "Grace Hopper",
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const TenantPartnershipsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "revenue_share_percent": 5.92,
            
        
    
        
        
            
                "effective_from": new Date(Date.now()),
            
        
    
        
        
            
                "effective_to": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "pending",
            
        
    
        
        
            
                "revenue_share_percent": 6.39,
            
        
    
        
        
            
                "effective_from": new Date(Date.now()),
            
        
    
        
        
            
                "effective_to": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                "revenue_share_percent": 8.79,
            
        
    
        
        
            
                "effective_from": new Date(Date.now()),
            
        
    
        
        
            
                "effective_to": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PayoutsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider": "helcim",
            
        
    
        
        
            
                "provider_reference": "Ada Lovelace",
            
        
    
        
        
            
                "amount": 4.33,
            
        
    
        
        
            
                "currency_code": "Grace Hopper",
            
        
    
        
        
            
                "payout_status": "canceled",
            
        
    
        
        
            
                "scheduled_at": new Date(Date.now()),
            
        
    
        
        
            
                "paid_at": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider": "manual",
            
        
    
        
        
            
                "provider_reference": "Alan Turing",
            
        
    
        
        
            
                "amount": 6.99,
            
        
    
        
        
            
                "currency_code": "Alan Turing",
            
        
    
        
        
            
                "payout_status": "processing",
            
        
    
        
        
            
                "scheduled_at": new Date(Date.now()),
            
        
    
        
        
            
                "paid_at": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider": "helcim",
            
        
    
        
        
            
                "provider_reference": "Marie Curie",
            
        
    
        
        
            
                "amount": 2.79,
            
        
    
        
        
            
                "currency_code": "Alan Turing",
            
        
    
        
        
            
                "payout_status": "paid",
            
        
    
        
        
            
                "scheduled_at": new Date(Date.now()),
            
        
    
        
        
            
                "paid_at": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const HelcimConfigurationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "environment": "production",
            
        
    
        
        
            
                "api_token_label": "Ada Lovelace",
            
        
    
        
        
            
                "enable_revenue_sharing": true,
            
        
    
        
        
            
                "platform_fee_percent": 7.61,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "environment": "sandbox",
            
        
    
        
        
            
                "api_token_label": "Marie Curie",
            
        
    
        
        
            
                "enable_revenue_sharing": false,
            
        
    
        
        
            
                "platform_fee_percent": 7.66,
            
        
    
        
        
            
                "is_active": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "environment": "production",
            
        
    
        
        
            
                "api_token_label": "Ada Lovelace",
            
        
    
        
        
            
                "enable_revenue_sharing": false,
            
        
    
        
        
            
                "platform_fee_percent": 5.68,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ReportsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "report_type": "tax_summary",
            
        
    
        
        
            
                "report_name": "Marie Curie",
            
        
    
        
        
            
                "period_start": new Date(Date.now()),
            
        
    
        
        
            
                "period_end": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "report_type": "product_sales",
            
        
    
        
        
            
                "report_name": "Grace Hopper",
            
        
    
        
        
            
                "period_start": new Date(Date.now()),
            
        
    
        
        
            
                "period_end": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "report_type": "shift_summary",
            
        
    
        
        
            
                "report_name": "Grace Hopper",
            
        
    
        
        
            
                "period_start": new Date(Date.now()),
            
        
    
        
        
            
                "period_end": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const AuditEventsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "occurred_at": new Date(Date.now()),
            
        
    
        
        
            
                "event_type": "auth",
            
        
    
        
        
            
                "action": "Marie Curie",
            
        
    
        
        
            
                "entity_name": "Ada Lovelace",
            
        
    
        
        
            
                "entity_reference": "Grace Hopper",
            
        
    
        
        
            
                "ip_address": "Alan Turing",
            
        
    
        
        
            
                "user_agent": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "occurred_at": new Date(Date.now()),
            
        
    
        
        
            
                "event_type": "pos",
            
        
    
        
        
            
                "action": "Grace Hopper",
            
        
    
        
        
            
                "entity_name": "Grace Hopper",
            
        
    
        
        
            
                "entity_reference": "Alan Turing",
            
        
    
        
        
            
                "ip_address": "Marie Curie",
            
        
    
        
        
            
                "user_agent": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "occurred_at": new Date(Date.now()),
            
        
    
        
        
            
                "event_type": "payments",
            
        
    
        
        
            
                "action": "Grace Hopper",
            
        
    
        
        
            
                "entity_name": "Grace Hopper",
            
        
    
        
        
            
                "entity_reference": "Alan Turing",
            
        
    
        
        
            
                "ip_address": "Grace Hopper",
            
        
    
        
        
            
                "user_agent": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];




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

    
    
    
    
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateTenantWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Tenant0 = await Tenants.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Tenant0?.setOrganization)
                {
                    await
                    Tenant0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Tenant1 = await Tenants.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Tenant1?.setOrganization)
                {
                    await
                    Tenant1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Tenant2 = await Tenants.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Tenant2?.setOrganization)
                {
                    await
                    Tenant2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateLocationWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Location0 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Location0?.setTenant)
                {
                    await
                    Location0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Location1 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Location1?.setTenant)
                {
                    await
                    Location1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Location2 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Location2?.setTenant)
                {
                    await
                    Location2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateLocationWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Location0 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Location0?.setOrganization)
                {
                    await
                    Location0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Location1 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Location1?.setOrganization)
                {
                    await
                    Location1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Location2 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Location2?.setOrganization)
                {
                    await
                    Location2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
    
        
            
            async function associateRolePermissionWithPermission() {
            
                const relatedPermission0 = await Permissions.findOne({
                    offset: Math.floor(Math.random() * (await Permissions.count())),
                });
                const RolePermission0 = await RolePermissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RolePermission0?.setPermission)
                {
                    await
                    RolePermission0.
                    setPermission(relatedPermission0);
                }
            
                const relatedPermission1 = await Permissions.findOne({
                    offset: Math.floor(Math.random() * (await Permissions.count())),
                });
                const RolePermission1 = await RolePermissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RolePermission1?.setPermission)
                {
                    await
                    RolePermission1.
                    setPermission(relatedPermission1);
                }
            
                const relatedPermission2 = await Permissions.findOne({
                    offset: Math.floor(Math.random() * (await Permissions.count())),
                });
                const RolePermission2 = await RolePermissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RolePermission2?.setPermission)
                {
                    await
                    RolePermission2.
                    setPermission(relatedPermission2);
                }
            
        }
        
    
        
    
        
            
            async function associateRolePermissionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RolePermission0 = await RolePermissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RolePermission0?.setOrganization)
                {
                    await
                    RolePermission0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RolePermission1 = await RolePermissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RolePermission1?.setOrganization)
                {
                    await
                    RolePermission1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RolePermission2 = await RolePermissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RolePermission2?.setOrganization)
                {
                    await
                    RolePermission2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateTenantMembershipWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const TenantMembership0 = await TenantMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TenantMembership0?.setTenant)
                {
                    await
                    TenantMembership0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const TenantMembership1 = await TenantMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TenantMembership1?.setTenant)
                {
                    await
                    TenantMembership1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const TenantMembership2 = await TenantMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TenantMembership2?.setTenant)
                {
                    await
                    TenantMembership2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
            
            async function associateTenantMembershipWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const TenantMembership0 = await TenantMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TenantMembership0?.setUser)
                {
                    await
                    TenantMembership0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const TenantMembership1 = await TenantMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TenantMembership1?.setUser)
                {
                    await
                    TenantMembership1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const TenantMembership2 = await TenantMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TenantMembership2?.setUser)
                {
                    await
                    TenantMembership2.
                    setUser(relatedUser2);
                }
            
        }
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
    
        
    
        
    
        
            
            async function associateTenantMembershipWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TenantMembership0 = await TenantMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TenantMembership0?.setOrganization)
                {
                    await
                    TenantMembership0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TenantMembership1 = await TenantMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TenantMembership1?.setOrganization)
                {
                    await
                    TenantMembership1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TenantMembership2 = await TenantMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TenantMembership2?.setOrganization)
                {
                    await
                    TenantMembership2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCustomerWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Customer0 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Customer0?.setTenant)
                {
                    await
                    Customer0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Customer1 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Customer1?.setTenant)
                {
                    await
                    Customer1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Customer2 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Customer2?.setTenant)
                {
                    await
                    Customer2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCustomerWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Customer0 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Customer0?.setOrganization)
                {
                    await
                    Customer0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Customer1 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Customer1?.setOrganization)
                {
                    await
                    Customer1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Customer2 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Customer2?.setOrganization)
                {
                    await
                    Customer2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateProductWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Product0 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Product0?.setTenant)
                {
                    await
                    Product0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Product1 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Product1?.setTenant)
                {
                    await
                    Product1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Product2 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Product2?.setTenant)
                {
                    await
                    Product2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateProductWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Product0 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Product0?.setOrganization)
                {
                    await
                    Product0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Product1 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Product1?.setOrganization)
                {
                    await
                    Product1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Product2 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Product2?.setOrganization)
                {
                    await
                    Product2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateProductVariantWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const ProductVariant0 = await ProductVariants.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductVariant0?.setProduct)
                {
                    await
                    ProductVariant0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const ProductVariant1 = await ProductVariants.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductVariant1?.setProduct)
                {
                    await
                    ProductVariant1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const ProductVariant2 = await ProductVariants.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductVariant2?.setProduct)
                {
                    await
                    ProductVariant2.
                    setProduct(relatedProduct2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateProductVariantWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProductVariant0 = await ProductVariants.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductVariant0?.setOrganization)
                {
                    await
                    ProductVariant0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProductVariant1 = await ProductVariants.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductVariant1?.setOrganization)
                {
                    await
                    ProductVariant1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProductVariant2 = await ProductVariants.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductVariant2?.setOrganization)
                {
                    await
                    ProductVariant2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateTaxRateWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const TaxRate0 = await TaxRates.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TaxRate0?.setTenant)
                {
                    await
                    TaxRate0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const TaxRate1 = await TaxRates.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TaxRate1?.setTenant)
                {
                    await
                    TaxRate1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const TaxRate2 = await TaxRates.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TaxRate2?.setTenant)
                {
                    await
                    TaxRate2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateTaxRateWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TaxRate0 = await TaxRates.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TaxRate0?.setOrganization)
                {
                    await
                    TaxRate0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TaxRate1 = await TaxRates.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TaxRate1?.setOrganization)
                {
                    await
                    TaxRate1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TaxRate2 = await TaxRates.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TaxRate2?.setOrganization)
                {
                    await
                    TaxRate2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateDiscountWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Discount0 = await Discounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Discount0?.setTenant)
                {
                    await
                    Discount0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Discount1 = await Discounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Discount1?.setTenant)
                {
                    await
                    Discount1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Discount2 = await Discounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Discount2?.setTenant)
                {
                    await
                    Discount2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateDiscountWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Discount0 = await Discounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Discount0?.setOrganization)
                {
                    await
                    Discount0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Discount1 = await Discounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Discount1?.setOrganization)
                {
                    await
                    Discount1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Discount2 = await Discounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Discount2?.setOrganization)
                {
                    await
                    Discount2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateRegisterWithLocation() {
            
                const relatedLocation0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Register0 = await Registers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Register0?.setLocation)
                {
                    await
                    Register0.
                    setLocation(relatedLocation0);
                }
            
                const relatedLocation1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Register1 = await Registers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Register1?.setLocation)
                {
                    await
                    Register1.
                    setLocation(relatedLocation1);
                }
            
                const relatedLocation2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Register2 = await Registers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Register2?.setLocation)
                {
                    await
                    Register2.
                    setLocation(relatedLocation2);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateRegisterWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Register0 = await Registers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Register0?.setOrganization)
                {
                    await
                    Register0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Register1 = await Registers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Register1?.setOrganization)
                {
                    await
                    Register1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Register2 = await Registers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Register2?.setOrganization)
                {
                    await
                    Register2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateShiftWithRegister() {
            
                const relatedRegister0 = await Registers.findOne({
                    offset: Math.floor(Math.random() * (await Registers.count())),
                });
                const Shift0 = await Shifts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Shift0?.setRegister)
                {
                    await
                    Shift0.
                    setRegister(relatedRegister0);
                }
            
                const relatedRegister1 = await Registers.findOne({
                    offset: Math.floor(Math.random() * (await Registers.count())),
                });
                const Shift1 = await Shifts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Shift1?.setRegister)
                {
                    await
                    Shift1.
                    setRegister(relatedRegister1);
                }
            
                const relatedRegister2 = await Registers.findOne({
                    offset: Math.floor(Math.random() * (await Registers.count())),
                });
                const Shift2 = await Shifts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Shift2?.setRegister)
                {
                    await
                    Shift2.
                    setRegister(relatedRegister2);
                }
            
        }
        
    
        
            
            async function associateShiftWithOpened_by_user() {
            
                const relatedOpened_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Shift0 = await Shifts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Shift0?.setOpened_by_user)
                {
                    await
                    Shift0.
                    setOpened_by_user(relatedOpened_by_user0);
                }
            
                const relatedOpened_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Shift1 = await Shifts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Shift1?.setOpened_by_user)
                {
                    await
                    Shift1.
                    setOpened_by_user(relatedOpened_by_user1);
                }
            
                const relatedOpened_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Shift2 = await Shifts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Shift2?.setOpened_by_user)
                {
                    await
                    Shift2.
                    setOpened_by_user(relatedOpened_by_user2);
                }
            
        }
        
    
        
            
            async function associateShiftWithClosed_by_user() {
            
                const relatedClosed_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Shift0 = await Shifts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Shift0?.setClosed_by_user)
                {
                    await
                    Shift0.
                    setClosed_by_user(relatedClosed_by_user0);
                }
            
                const relatedClosed_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Shift1 = await Shifts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Shift1?.setClosed_by_user)
                {
                    await
                    Shift1.
                    setClosed_by_user(relatedClosed_by_user1);
                }
            
                const relatedClosed_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Shift2 = await Shifts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Shift2?.setClosed_by_user)
                {
                    await
                    Shift2.
                    setClosed_by_user(relatedClosed_by_user2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateShiftWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Shift0 = await Shifts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Shift0?.setOrganization)
                {
                    await
                    Shift0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Shift1 = await Shifts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Shift1?.setOrganization)
                {
                    await
                    Shift1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Shift2 = await Shifts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Shift2?.setOrganization)
                {
                    await
                    Shift2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCartWithLocation() {
            
                const relatedLocation0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Cart0 = await Carts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Cart0?.setLocation)
                {
                    await
                    Cart0.
                    setLocation(relatedLocation0);
                }
            
                const relatedLocation1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Cart1 = await Carts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Cart1?.setLocation)
                {
                    await
                    Cart1.
                    setLocation(relatedLocation1);
                }
            
                const relatedLocation2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Cart2 = await Carts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Cart2?.setLocation)
                {
                    await
                    Cart2.
                    setLocation(relatedLocation2);
                }
            
        }
        
    
        
            
            async function associateCartWithRegister() {
            
                const relatedRegister0 = await Registers.findOne({
                    offset: Math.floor(Math.random() * (await Registers.count())),
                });
                const Cart0 = await Carts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Cart0?.setRegister)
                {
                    await
                    Cart0.
                    setRegister(relatedRegister0);
                }
            
                const relatedRegister1 = await Registers.findOne({
                    offset: Math.floor(Math.random() * (await Registers.count())),
                });
                const Cart1 = await Carts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Cart1?.setRegister)
                {
                    await
                    Cart1.
                    setRegister(relatedRegister1);
                }
            
                const relatedRegister2 = await Registers.findOne({
                    offset: Math.floor(Math.random() * (await Registers.count())),
                });
                const Cart2 = await Carts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Cart2?.setRegister)
                {
                    await
                    Cart2.
                    setRegister(relatedRegister2);
                }
            
        }
        
    
        
            
            async function associateCartWithShift() {
            
                const relatedShift0 = await Shifts.findOne({
                    offset: Math.floor(Math.random() * (await Shifts.count())),
                });
                const Cart0 = await Carts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Cart0?.setShift)
                {
                    await
                    Cart0.
                    setShift(relatedShift0);
                }
            
                const relatedShift1 = await Shifts.findOne({
                    offset: Math.floor(Math.random() * (await Shifts.count())),
                });
                const Cart1 = await Carts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Cart1?.setShift)
                {
                    await
                    Cart1.
                    setShift(relatedShift1);
                }
            
                const relatedShift2 = await Shifts.findOne({
                    offset: Math.floor(Math.random() * (await Shifts.count())),
                });
                const Cart2 = await Carts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Cart2?.setShift)
                {
                    await
                    Cart2.
                    setShift(relatedShift2);
                }
            
        }
        
    
        
            
            async function associateCartWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Cart0 = await Carts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Cart0?.setCustomer)
                {
                    await
                    Cart0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Cart1 = await Carts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Cart1?.setCustomer)
                {
                    await
                    Cart1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Cart2 = await Carts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Cart2?.setCustomer)
                {
                    await
                    Cart2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
            
            async function associateCartWithOpened_by_user() {
            
                const relatedOpened_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Cart0 = await Carts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Cart0?.setOpened_by_user)
                {
                    await
                    Cart0.
                    setOpened_by_user(relatedOpened_by_user0);
                }
            
                const relatedOpened_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Cart1 = await Carts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Cart1?.setOpened_by_user)
                {
                    await
                    Cart1.
                    setOpened_by_user(relatedOpened_by_user1);
                }
            
                const relatedOpened_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Cart2 = await Carts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Cart2?.setOpened_by_user)
                {
                    await
                    Cart2.
                    setOpened_by_user(relatedOpened_by_user2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCartWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Cart0 = await Carts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Cart0?.setOrganization)
                {
                    await
                    Cart0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Cart1 = await Carts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Cart1?.setOrganization)
                {
                    await
                    Cart1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Cart2 = await Carts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Cart2?.setOrganization)
                {
                    await
                    Cart2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCartItemWithCart() {
            
                const relatedCart0 = await Carts.findOne({
                    offset: Math.floor(Math.random() * (await Carts.count())),
                });
                const CartItem0 = await CartItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CartItem0?.setCart)
                {
                    await
                    CartItem0.
                    setCart(relatedCart0);
                }
            
                const relatedCart1 = await Carts.findOne({
                    offset: Math.floor(Math.random() * (await Carts.count())),
                });
                const CartItem1 = await CartItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CartItem1?.setCart)
                {
                    await
                    CartItem1.
                    setCart(relatedCart1);
                }
            
                const relatedCart2 = await Carts.findOne({
                    offset: Math.floor(Math.random() * (await Carts.count())),
                });
                const CartItem2 = await CartItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CartItem2?.setCart)
                {
                    await
                    CartItem2.
                    setCart(relatedCart2);
                }
            
        }
        
    
        
            
            async function associateCartItemWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const CartItem0 = await CartItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CartItem0?.setProduct)
                {
                    await
                    CartItem0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const CartItem1 = await CartItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CartItem1?.setProduct)
                {
                    await
                    CartItem1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const CartItem2 = await CartItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CartItem2?.setProduct)
                {
                    await
                    CartItem2.
                    setProduct(relatedProduct2);
                }
            
        }
        
    
        
            
            async function associateCartItemWithProduct_variant() {
            
                const relatedProduct_variant0 = await ProductVariants.findOne({
                    offset: Math.floor(Math.random() * (await ProductVariants.count())),
                });
                const CartItem0 = await CartItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CartItem0?.setProduct_variant)
                {
                    await
                    CartItem0.
                    setProduct_variant(relatedProduct_variant0);
                }
            
                const relatedProduct_variant1 = await ProductVariants.findOne({
                    offset: Math.floor(Math.random() * (await ProductVariants.count())),
                });
                const CartItem1 = await CartItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CartItem1?.setProduct_variant)
                {
                    await
                    CartItem1.
                    setProduct_variant(relatedProduct_variant1);
                }
            
                const relatedProduct_variant2 = await ProductVariants.findOne({
                    offset: Math.floor(Math.random() * (await ProductVariants.count())),
                });
                const CartItem2 = await CartItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CartItem2?.setProduct_variant)
                {
                    await
                    CartItem2.
                    setProduct_variant(relatedProduct_variant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCartItemWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CartItem0 = await CartItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CartItem0?.setOrganization)
                {
                    await
                    CartItem0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CartItem1 = await CartItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CartItem1?.setOrganization)
                {
                    await
                    CartItem1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CartItem2 = await CartItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CartItem2?.setOrganization)
                {
                    await
                    CartItem2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateOrderWithLocation() {
            
                const relatedLocation0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Order0 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Order0?.setLocation)
                {
                    await
                    Order0.
                    setLocation(relatedLocation0);
                }
            
                const relatedLocation1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Order1 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Order1?.setLocation)
                {
                    await
                    Order1.
                    setLocation(relatedLocation1);
                }
            
                const relatedLocation2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Order2 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Order2?.setLocation)
                {
                    await
                    Order2.
                    setLocation(relatedLocation2);
                }
            
        }
        
    
        
            
            async function associateOrderWithRegister() {
            
                const relatedRegister0 = await Registers.findOne({
                    offset: Math.floor(Math.random() * (await Registers.count())),
                });
                const Order0 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Order0?.setRegister)
                {
                    await
                    Order0.
                    setRegister(relatedRegister0);
                }
            
                const relatedRegister1 = await Registers.findOne({
                    offset: Math.floor(Math.random() * (await Registers.count())),
                });
                const Order1 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Order1?.setRegister)
                {
                    await
                    Order1.
                    setRegister(relatedRegister1);
                }
            
                const relatedRegister2 = await Registers.findOne({
                    offset: Math.floor(Math.random() * (await Registers.count())),
                });
                const Order2 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Order2?.setRegister)
                {
                    await
                    Order2.
                    setRegister(relatedRegister2);
                }
            
        }
        
    
        
            
            async function associateOrderWithShift() {
            
                const relatedShift0 = await Shifts.findOne({
                    offset: Math.floor(Math.random() * (await Shifts.count())),
                });
                const Order0 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Order0?.setShift)
                {
                    await
                    Order0.
                    setShift(relatedShift0);
                }
            
                const relatedShift1 = await Shifts.findOne({
                    offset: Math.floor(Math.random() * (await Shifts.count())),
                });
                const Order1 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Order1?.setShift)
                {
                    await
                    Order1.
                    setShift(relatedShift1);
                }
            
                const relatedShift2 = await Shifts.findOne({
                    offset: Math.floor(Math.random() * (await Shifts.count())),
                });
                const Order2 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Order2?.setShift)
                {
                    await
                    Order2.
                    setShift(relatedShift2);
                }
            
        }
        
    
        
            
            async function associateOrderWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Order0 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Order0?.setCustomer)
                {
                    await
                    Order0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Order1 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Order1?.setCustomer)
                {
                    await
                    Order1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Order2 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Order2?.setCustomer)
                {
                    await
                    Order2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
            
            async function associateOrderWithCashier_user() {
            
                const relatedCashier_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Order0 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Order0?.setCashier_user)
                {
                    await
                    Order0.
                    setCashier_user(relatedCashier_user0);
                }
            
                const relatedCashier_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Order1 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Order1?.setCashier_user)
                {
                    await
                    Order1.
                    setCashier_user(relatedCashier_user1);
                }
            
                const relatedCashier_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Order2 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Order2?.setCashier_user)
                {
                    await
                    Order2.
                    setCashier_user(relatedCashier_user2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateOrderWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Order0 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Order0?.setOrganization)
                {
                    await
                    Order0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Order1 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Order1?.setOrganization)
                {
                    await
                    Order1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Order2 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Order2?.setOrganization)
                {
                    await
                    Order2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateOrderItemWithOrder() {
            
                const relatedOrder0 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const OrderItem0 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (OrderItem0?.setOrder)
                {
                    await
                    OrderItem0.
                    setOrder(relatedOrder0);
                }
            
                const relatedOrder1 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const OrderItem1 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (OrderItem1?.setOrder)
                {
                    await
                    OrderItem1.
                    setOrder(relatedOrder1);
                }
            
                const relatedOrder2 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const OrderItem2 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (OrderItem2?.setOrder)
                {
                    await
                    OrderItem2.
                    setOrder(relatedOrder2);
                }
            
        }
        
    
        
            
            async function associateOrderItemWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const OrderItem0 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (OrderItem0?.setProduct)
                {
                    await
                    OrderItem0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const OrderItem1 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (OrderItem1?.setProduct)
                {
                    await
                    OrderItem1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const OrderItem2 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (OrderItem2?.setProduct)
                {
                    await
                    OrderItem2.
                    setProduct(relatedProduct2);
                }
            
        }
        
    
        
            
            async function associateOrderItemWithProduct_variant() {
            
                const relatedProduct_variant0 = await ProductVariants.findOne({
                    offset: Math.floor(Math.random() * (await ProductVariants.count())),
                });
                const OrderItem0 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (OrderItem0?.setProduct_variant)
                {
                    await
                    OrderItem0.
                    setProduct_variant(relatedProduct_variant0);
                }
            
                const relatedProduct_variant1 = await ProductVariants.findOne({
                    offset: Math.floor(Math.random() * (await ProductVariants.count())),
                });
                const OrderItem1 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (OrderItem1?.setProduct_variant)
                {
                    await
                    OrderItem1.
                    setProduct_variant(relatedProduct_variant1);
                }
            
                const relatedProduct_variant2 = await ProductVariants.findOne({
                    offset: Math.floor(Math.random() * (await ProductVariants.count())),
                });
                const OrderItem2 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (OrderItem2?.setProduct_variant)
                {
                    await
                    OrderItem2.
                    setProduct_variant(relatedProduct_variant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateOrderItemWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OrderItem0 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (OrderItem0?.setOrganization)
                {
                    await
                    OrderItem0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OrderItem1 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (OrderItem1?.setOrganization)
                {
                    await
                    OrderItem1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OrderItem2 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (OrderItem2?.setOrganization)
                {
                    await
                    OrderItem2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associatePaymentIntentWithOrder() {
            
                const relatedOrder0 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const PaymentIntent0 = await PaymentIntents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PaymentIntent0?.setOrder)
                {
                    await
                    PaymentIntent0.
                    setOrder(relatedOrder0);
                }
            
                const relatedOrder1 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const PaymentIntent1 = await PaymentIntents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PaymentIntent1?.setOrder)
                {
                    await
                    PaymentIntent1.
                    setOrder(relatedOrder1);
                }
            
                const relatedOrder2 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const PaymentIntent2 = await PaymentIntents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PaymentIntent2?.setOrder)
                {
                    await
                    PaymentIntent2.
                    setOrder(relatedOrder2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePaymentIntentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PaymentIntent0 = await PaymentIntents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PaymentIntent0?.setOrganization)
                {
                    await
                    PaymentIntent0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PaymentIntent1 = await PaymentIntents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PaymentIntent1?.setOrganization)
                {
                    await
                    PaymentIntent1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PaymentIntent2 = await PaymentIntents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PaymentIntent2?.setOrganization)
                {
                    await
                    PaymentIntent2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associatePaymentWithPayment_intent() {
            
                const relatedPayment_intent0 = await PaymentIntents.findOne({
                    offset: Math.floor(Math.random() * (await PaymentIntents.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setPayment_intent)
                {
                    await
                    Payment0.
                    setPayment_intent(relatedPayment_intent0);
                }
            
                const relatedPayment_intent1 = await PaymentIntents.findOne({
                    offset: Math.floor(Math.random() * (await PaymentIntents.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setPayment_intent)
                {
                    await
                    Payment1.
                    setPayment_intent(relatedPayment_intent1);
                }
            
                const relatedPayment_intent2 = await PaymentIntents.findOne({
                    offset: Math.floor(Math.random() * (await PaymentIntents.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setPayment_intent)
                {
                    await
                    Payment2.
                    setPayment_intent(relatedPayment_intent2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePaymentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setOrganization)
                {
                    await
                    Payment0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setOrganization)
                {
                    await
                    Payment1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setOrganization)
                {
                    await
                    Payment2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateRefundWithPayment() {
            
                const relatedPayment0 = await Payments.findOne({
                    offset: Math.floor(Math.random() * (await Payments.count())),
                });
                const Refund0 = await Refunds.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Refund0?.setPayment)
                {
                    await
                    Refund0.
                    setPayment(relatedPayment0);
                }
            
                const relatedPayment1 = await Payments.findOne({
                    offset: Math.floor(Math.random() * (await Payments.count())),
                });
                const Refund1 = await Refunds.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Refund1?.setPayment)
                {
                    await
                    Refund1.
                    setPayment(relatedPayment1);
                }
            
                const relatedPayment2 = await Payments.findOne({
                    offset: Math.floor(Math.random() * (await Payments.count())),
                });
                const Refund2 = await Refunds.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Refund2?.setPayment)
                {
                    await
                    Refund2.
                    setPayment(relatedPayment2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateRefundWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Refund0 = await Refunds.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Refund0?.setOrganization)
                {
                    await
                    Refund0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Refund1 = await Refunds.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Refund1?.setOrganization)
                {
                    await
                    Refund1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Refund2 = await Refunds.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Refund2?.setOrganization)
                {
                    await
                    Refund2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateInventoryItemWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryItem0 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryItem0?.setProduct)
                {
                    await
                    InventoryItem0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryItem1 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryItem1?.setProduct)
                {
                    await
                    InventoryItem1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryItem2 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryItem2?.setProduct)
                {
                    await
                    InventoryItem2.
                    setProduct(relatedProduct2);
                }
            
        }
        
    
        
            
            async function associateInventoryItemWithProduct_variant() {
            
                const relatedProduct_variant0 = await ProductVariants.findOne({
                    offset: Math.floor(Math.random() * (await ProductVariants.count())),
                });
                const InventoryItem0 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryItem0?.setProduct_variant)
                {
                    await
                    InventoryItem0.
                    setProduct_variant(relatedProduct_variant0);
                }
            
                const relatedProduct_variant1 = await ProductVariants.findOne({
                    offset: Math.floor(Math.random() * (await ProductVariants.count())),
                });
                const InventoryItem1 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryItem1?.setProduct_variant)
                {
                    await
                    InventoryItem1.
                    setProduct_variant(relatedProduct_variant1);
                }
            
                const relatedProduct_variant2 = await ProductVariants.findOne({
                    offset: Math.floor(Math.random() * (await ProductVariants.count())),
                });
                const InventoryItem2 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryItem2?.setProduct_variant)
                {
                    await
                    InventoryItem2.
                    setProduct_variant(relatedProduct_variant2);
                }
            
        }
        
    
        
            
            async function associateInventoryItemWithLocation() {
            
                const relatedLocation0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryItem0 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryItem0?.setLocation)
                {
                    await
                    InventoryItem0.
                    setLocation(relatedLocation0);
                }
            
                const relatedLocation1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryItem1 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryItem1?.setLocation)
                {
                    await
                    InventoryItem1.
                    setLocation(relatedLocation1);
                }
            
                const relatedLocation2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryItem2 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryItem2?.setLocation)
                {
                    await
                    InventoryItem2.
                    setLocation(relatedLocation2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateInventoryItemWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryItem0 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryItem0?.setOrganization)
                {
                    await
                    InventoryItem0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryItem1 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryItem1?.setOrganization)
                {
                    await
                    InventoryItem1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryItem2 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryItem2?.setOrganization)
                {
                    await
                    InventoryItem2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateInventoryAdjustmentWithInventory_item() {
            
                const relatedInventory_item0 = await InventoryItems.findOne({
                    offset: Math.floor(Math.random() * (await InventoryItems.count())),
                });
                const InventoryAdjustment0 = await InventoryAdjustments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryAdjustment0?.setInventory_item)
                {
                    await
                    InventoryAdjustment0.
                    setInventory_item(relatedInventory_item0);
                }
            
                const relatedInventory_item1 = await InventoryItems.findOne({
                    offset: Math.floor(Math.random() * (await InventoryItems.count())),
                });
                const InventoryAdjustment1 = await InventoryAdjustments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryAdjustment1?.setInventory_item)
                {
                    await
                    InventoryAdjustment1.
                    setInventory_item(relatedInventory_item1);
                }
            
                const relatedInventory_item2 = await InventoryItems.findOne({
                    offset: Math.floor(Math.random() * (await InventoryItems.count())),
                });
                const InventoryAdjustment2 = await InventoryAdjustments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryAdjustment2?.setInventory_item)
                {
                    await
                    InventoryAdjustment2.
                    setInventory_item(relatedInventory_item2);
                }
            
        }
        
    
        
            
            async function associateInventoryAdjustmentWithAdjusted_by_user() {
            
                const relatedAdjusted_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryAdjustment0 = await InventoryAdjustments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryAdjustment0?.setAdjusted_by_user)
                {
                    await
                    InventoryAdjustment0.
                    setAdjusted_by_user(relatedAdjusted_by_user0);
                }
            
                const relatedAdjusted_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryAdjustment1 = await InventoryAdjustments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryAdjustment1?.setAdjusted_by_user)
                {
                    await
                    InventoryAdjustment1.
                    setAdjusted_by_user(relatedAdjusted_by_user1);
                }
            
                const relatedAdjusted_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryAdjustment2 = await InventoryAdjustments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryAdjustment2?.setAdjusted_by_user)
                {
                    await
                    InventoryAdjustment2.
                    setAdjusted_by_user(relatedAdjusted_by_user2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateInventoryAdjustmentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryAdjustment0 = await InventoryAdjustments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryAdjustment0?.setOrganization)
                {
                    await
                    InventoryAdjustment0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryAdjustment1 = await InventoryAdjustments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryAdjustment1?.setOrganization)
                {
                    await
                    InventoryAdjustment1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryAdjustment2 = await InventoryAdjustments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryAdjustment2?.setOrganization)
                {
                    await
                    InventoryAdjustment2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePartnerWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Partner0 = await Partners.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Partner0?.setOrganization)
                {
                    await
                    Partner0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Partner1 = await Partners.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Partner1?.setOrganization)
                {
                    await
                    Partner1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Partner2 = await Partners.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Partner2?.setOrganization)
                {
                    await
                    Partner2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateTenantPartnershipWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const TenantPartnership0 = await TenantPartnerships.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TenantPartnership0?.setTenant)
                {
                    await
                    TenantPartnership0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const TenantPartnership1 = await TenantPartnerships.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TenantPartnership1?.setTenant)
                {
                    await
                    TenantPartnership1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const TenantPartnership2 = await TenantPartnerships.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TenantPartnership2?.setTenant)
                {
                    await
                    TenantPartnership2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
            
            async function associateTenantPartnershipWithPartner() {
            
                const relatedPartner0 = await Partners.findOne({
                    offset: Math.floor(Math.random() * (await Partners.count())),
                });
                const TenantPartnership0 = await TenantPartnerships.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TenantPartnership0?.setPartner)
                {
                    await
                    TenantPartnership0.
                    setPartner(relatedPartner0);
                }
            
                const relatedPartner1 = await Partners.findOne({
                    offset: Math.floor(Math.random() * (await Partners.count())),
                });
                const TenantPartnership1 = await TenantPartnerships.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TenantPartnership1?.setPartner)
                {
                    await
                    TenantPartnership1.
                    setPartner(relatedPartner1);
                }
            
                const relatedPartner2 = await Partners.findOne({
                    offset: Math.floor(Math.random() * (await Partners.count())),
                });
                const TenantPartnership2 = await TenantPartnerships.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TenantPartnership2?.setPartner)
                {
                    await
                    TenantPartnership2.
                    setPartner(relatedPartner2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateTenantPartnershipWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TenantPartnership0 = await TenantPartnerships.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TenantPartnership0?.setOrganization)
                {
                    await
                    TenantPartnership0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TenantPartnership1 = await TenantPartnerships.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TenantPartnership1?.setOrganization)
                {
                    await
                    TenantPartnership1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TenantPartnership2 = await TenantPartnerships.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TenantPartnership2?.setOrganization)
                {
                    await
                    TenantPartnership2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associatePayoutWithPartner() {
            
                const relatedPartner0 = await Partners.findOne({
                    offset: Math.floor(Math.random() * (await Partners.count())),
                });
                const Payout0 = await Payouts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payout0?.setPartner)
                {
                    await
                    Payout0.
                    setPartner(relatedPartner0);
                }
            
                const relatedPartner1 = await Partners.findOne({
                    offset: Math.floor(Math.random() * (await Partners.count())),
                });
                const Payout1 = await Payouts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payout1?.setPartner)
                {
                    await
                    Payout1.
                    setPartner(relatedPartner1);
                }
            
                const relatedPartner2 = await Partners.findOne({
                    offset: Math.floor(Math.random() * (await Partners.count())),
                });
                const Payout2 = await Payouts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payout2?.setPartner)
                {
                    await
                    Payout2.
                    setPartner(relatedPartner2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePayoutWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payout0 = await Payouts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payout0?.setOrganization)
                {
                    await
                    Payout0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payout1 = await Payouts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payout1?.setOrganization)
                {
                    await
                    Payout1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payout2 = await Payouts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payout2?.setOrganization)
                {
                    await
                    Payout2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateHelcimConfigurationWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const HelcimConfiguration0 = await HelcimConfigurations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (HelcimConfiguration0?.setTenant)
                {
                    await
                    HelcimConfiguration0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const HelcimConfiguration1 = await HelcimConfigurations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (HelcimConfiguration1?.setTenant)
                {
                    await
                    HelcimConfiguration1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const HelcimConfiguration2 = await HelcimConfigurations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (HelcimConfiguration2?.setTenant)
                {
                    await
                    HelcimConfiguration2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateHelcimConfigurationWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const HelcimConfiguration0 = await HelcimConfigurations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (HelcimConfiguration0?.setOrganization)
                {
                    await
                    HelcimConfiguration0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const HelcimConfiguration1 = await HelcimConfigurations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (HelcimConfiguration1?.setOrganization)
                {
                    await
                    HelcimConfiguration1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const HelcimConfiguration2 = await HelcimConfigurations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (HelcimConfiguration2?.setOrganization)
                {
                    await
                    HelcimConfiguration2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateReportWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Report0 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Report0?.setTenant)
                {
                    await
                    Report0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Report1 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Report1?.setTenant)
                {
                    await
                    Report1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Report2 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Report2?.setTenant)
                {
                    await
                    Report2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
            
            async function associateReportWithLocation() {
            
                const relatedLocation0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Report0 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Report0?.setLocation)
                {
                    await
                    Report0.
                    setLocation(relatedLocation0);
                }
            
                const relatedLocation1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Report1 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Report1?.setLocation)
                {
                    await
                    Report1.
                    setLocation(relatedLocation1);
                }
            
                const relatedLocation2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Report2 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Report2?.setLocation)
                {
                    await
                    Report2.
                    setLocation(relatedLocation2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateReportWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Report0 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Report0?.setOrganization)
                {
                    await
                    Report0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Report1 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Report1?.setOrganization)
                {
                    await
                    Report1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Report2 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Report2?.setOrganization)
                {
                    await
                    Report2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateAuditEventWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const AuditEvent0 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuditEvent0?.setTenant)
                {
                    await
                    AuditEvent0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const AuditEvent1 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuditEvent1?.setTenant)
                {
                    await
                    AuditEvent1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const AuditEvent2 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuditEvent2?.setTenant)
                {
                    await
                    AuditEvent2.
                    setTenant(relatedTenant2);
                }
            
        }
        
    
        
            
            async function associateAuditEventWithActor_user() {
            
                const relatedActor_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditEvent0 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuditEvent0?.setActor_user)
                {
                    await
                    AuditEvent0.
                    setActor_user(relatedActor_user0);
                }
            
                const relatedActor_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditEvent1 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuditEvent1?.setActor_user)
                {
                    await
                    AuditEvent1.
                    setActor_user(relatedActor_user1);
                }
            
                const relatedActor_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditEvent2 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuditEvent2?.setActor_user)
                {
                    await
                    AuditEvent2.
                    setActor_user(relatedActor_user2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateAuditEventWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditEvent0 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuditEvent0?.setOrganization)
                {
                    await
                    AuditEvent0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditEvent1 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuditEvent1?.setOrganization)
                {
                    await
                    AuditEvent1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditEvent2 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuditEvent2?.setOrganization)
                {
                    await
                    AuditEvent2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Organizations.bulkCreate(OrganizationsData);
                
            
            
                
                await Tenants.bulkCreate(TenantsData);
                
            
            
                
                await Locations.bulkCreate(LocationsData);
                
            
            
                
                await RolePermissions.bulkCreate(RolePermissionsData);
                
            
            
                
                await TenantMemberships.bulkCreate(TenantMembershipsData);
                
            
            
                
                await Customers.bulkCreate(CustomersData);
                
            
            
                
                await Products.bulkCreate(ProductsData);
                
            
            
                
                await ProductVariants.bulkCreate(ProductVariantsData);
                
            
            
                
                await TaxRates.bulkCreate(TaxRatesData);
                
            
            
                
                await Discounts.bulkCreate(DiscountsData);
                
            
            
                
                await Registers.bulkCreate(RegistersData);
                
            
            
                
                await Shifts.bulkCreate(ShiftsData);
                
            
            
                
                await Carts.bulkCreate(CartsData);
                
            
            
                
                await CartItems.bulkCreate(CartItemsData);
                
            
            
                
                await Orders.bulkCreate(OrdersData);
                
            
            
                
                await OrderItems.bulkCreate(OrderItemsData);
                
            
            
                
                await PaymentIntents.bulkCreate(PaymentIntentsData);
                
            
            
                
                await Payments.bulkCreate(PaymentsData);
                
            
            
                
                await Refunds.bulkCreate(RefundsData);
                
            
            
                
                await InventoryItems.bulkCreate(InventoryItemsData);
                
            
            
                
                await InventoryAdjustments.bulkCreate(InventoryAdjustmentsData);
                
            
            
                
                await Partners.bulkCreate(PartnersData);
                
            
            
                
                await TenantPartnerships.bulkCreate(TenantPartnershipsData);
                
            
            
                
                await Payouts.bulkCreate(PayoutsData);
                
            
            
                
                await HelcimConfigurations.bulkCreate(HelcimConfigurationsData);
                
            
            
                
                await Reports.bulkCreate(ReportsData);
                
            
            
                
                await AuditEvents.bulkCreate(AuditEventsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateUserWithOrganization(),
                    
                
            
                
                
                
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateTenantWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateLocationWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateLocationWithOrganization(),
                    
                
            
                
                
                    
                
                    
                        
                        await associateRolePermissionWithPermission(),
                    
                
                    
                
                    
                        
                        await associateRolePermissionWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateTenantMembershipWithTenant(),
                    
                
                    
                        
                        await associateTenantMembershipWithUser(),
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateTenantMembershipWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCustomerWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCustomerWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateProductWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateProductWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateProductVariantWithProduct(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateProductVariantWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateTaxRateWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateTaxRateWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateDiscountWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateDiscountWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateRegisterWithLocation(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateRegisterWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateShiftWithRegister(),
                    
                
                    
                        
                        await associateShiftWithOpened_by_user(),
                    
                
                    
                        
                        await associateShiftWithClosed_by_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateShiftWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCartWithLocation(),
                    
                
                    
                        
                        await associateCartWithRegister(),
                    
                
                    
                        
                        await associateCartWithShift(),
                    
                
                    
                        
                        await associateCartWithCustomer(),
                    
                
                    
                        
                        await associateCartWithOpened_by_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCartWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCartItemWithCart(),
                    
                
                    
                        
                        await associateCartItemWithProduct(),
                    
                
                    
                        
                        await associateCartItemWithProduct_variant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCartItemWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateOrderWithLocation(),
                    
                
                    
                        
                        await associateOrderWithRegister(),
                    
                
                    
                        
                        await associateOrderWithShift(),
                    
                
                    
                        
                        await associateOrderWithCustomer(),
                    
                
                    
                        
                        await associateOrderWithCashier_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateOrderWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateOrderItemWithOrder(),
                    
                
                    
                        
                        await associateOrderItemWithProduct(),
                    
                
                    
                        
                        await associateOrderItemWithProduct_variant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateOrderItemWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associatePaymentIntentWithOrder(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePaymentIntentWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associatePaymentWithPayment_intent(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePaymentWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateRefundWithPayment(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateRefundWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateInventoryItemWithProduct(),
                    
                
                    
                        
                        await associateInventoryItemWithProduct_variant(),
                    
                
                    
                        
                        await associateInventoryItemWithLocation(),
                    
                
                    
                
                    
                
                    
                        
                        await associateInventoryItemWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateInventoryAdjustmentWithInventory_item(),
                    
                
                    
                        
                        await associateInventoryAdjustmentWithAdjusted_by_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInventoryAdjustmentWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePartnerWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateTenantPartnershipWithTenant(),
                    
                
                    
                        
                        await associateTenantPartnershipWithPartner(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateTenantPartnershipWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associatePayoutWithPartner(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePayoutWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateHelcimConfigurationWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateHelcimConfigurationWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateReportWithTenant(),
                    
                
                    
                        
                        await associateReportWithLocation(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateReportWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateAuditEventWithTenant(),
                    
                
                    
                        
                        await associateAuditEventWithActor_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateAuditEventWithOrganization(),
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('organizations', null, {});
            
            
            await queryInterface.bulkDelete('tenants', null, {});
            
            
            await queryInterface.bulkDelete('locations', null, {});
            
            
            await queryInterface.bulkDelete('role_permissions', null, {});
            
            
            await queryInterface.bulkDelete('tenant_memberships', null, {});
            
            
            await queryInterface.bulkDelete('customers', null, {});
            
            
            await queryInterface.bulkDelete('products', null, {});
            
            
            await queryInterface.bulkDelete('product_variants', null, {});
            
            
            await queryInterface.bulkDelete('tax_rates', null, {});
            
            
            await queryInterface.bulkDelete('discounts', null, {});
            
            
            await queryInterface.bulkDelete('registers', null, {});
            
            
            await queryInterface.bulkDelete('shifts', null, {});
            
            
            await queryInterface.bulkDelete('carts', null, {});
            
            
            await queryInterface.bulkDelete('cart_items', null, {});
            
            
            await queryInterface.bulkDelete('orders', null, {});
            
            
            await queryInterface.bulkDelete('order_items', null, {});
            
            
            await queryInterface.bulkDelete('payment_intents', null, {});
            
            
            await queryInterface.bulkDelete('payments', null, {});
            
            
            await queryInterface.bulkDelete('refunds', null, {});
            
            
            await queryInterface.bulkDelete('inventory_items', null, {});
            
            
            await queryInterface.bulkDelete('inventory_adjustments', null, {});
            
            
            await queryInterface.bulkDelete('partners', null, {});
            
            
            await queryInterface.bulkDelete('tenant_partnerships', null, {});
            
            
            await queryInterface.bulkDelete('payouts', null, {});
            
            
            await queryInterface.bulkDelete('helcim_configurations', null, {});
            
            
            await queryInterface.bulkDelete('reports', null, {});
            
            
            await queryInterface.bulkDelete('audit_events', null, {});
            
        
    },
};