-- Migration: Add warehouse tracking to stock_transactions and company_settings
-- Run: mysql -u root dms_db < dms_warehouse_migration.sql

ALTER TABLE stock_transactions
    ADD COLUMN intWarehouseId INT DEFAULT NULL AFTER strReference,
    ADD FOREIGN KEY (intWarehouseId) REFERENCES warehouses(intId) ON DELETE SET NULL;

ALTER TABLE company_settings
    ADD COLUMN intDefaultWarehouseId INT DEFAULT NULL AFTER strLogo,
    ADD FOREIGN KEY (intDefaultWarehouseId) REFERENCES warehouses(intId) ON DELETE SET NULL;
