39038-vm/db/migrations/add_user_ids_to_shipments.php
2026-03-08 10:11:07 +00:00

16 lines
601 B
PHP

<?php
require_once __DIR__ . '/../config.php';
$pdo = db();
try {
$pdo->exec("ALTER TABLE shipments ADD COLUMN shipper_id INT NULL AFTER id");
$pdo->exec("ALTER TABLE shipments ADD COLUMN truck_owner_id INT NULL AFTER offer_price");
// Add FK constraints (optional but good practice, keeping it simple for now to avoid issues with existing data)
// We won't enforce FK strictly on existing data as it might be NULL
echo "Added shipper_id and truck_owner_id to shipments table.";
} catch (PDOException $e) {
echo "Error (might already exist): " . $e->getMessage();
}