-- AlterTable
ALTER TABLE `company_settings` ADD COLUMN `warehouse_inventory_number_pattern` VARCHAR(100) NULL,
    ADD COLUMN `warehouse_inventory_prefix` VARCHAR(20) NULL,
    ADD COLUMN `warehouse_issue_number_pattern` VARCHAR(100) NULL,
    ADD COLUMN `warehouse_issue_prefix` VARCHAR(20) NULL,
    ADD COLUMN `warehouse_receipt_number_pattern` VARCHAR(100) NULL,
    ADD COLUMN `warehouse_receipt_prefix` VARCHAR(20) NULL;

-- Set backward-compatible defaults for existing installations
UPDATE `company_settings`
SET
  `warehouse_receipt_prefix` = 'PRI',
  `warehouse_receipt_number_pattern` = '{PREFIX}-{YYYY}-{NNN}',
  `warehouse_issue_prefix` = 'VYD',
  `warehouse_issue_number_pattern` = '{PREFIX}-{YYYY}-{NNN}',
  `warehouse_inventory_prefix` = 'INV',
  `warehouse_inventory_number_pattern` = '{PREFIX}-{YYYY}-{NNN}';