<?php
require_once 'includes/db.php';
session_start();

$company_id = $_SESSION['company_id'] ?? 1;

try {
    query("UPDATE machinery SET company_id = ? WHERE company_id IS NULL", [$company_id]);
    echo "Existing machinery records updated with company_id: $company_id\n";
} catch (Exception $e) {
    echo "Error updating records: " . $e->getMessage() . "\n";
}
