- Introduced `safety_seal` column in the `orders` table. - Updated order creation and completion logic to handle safety seal values. - Enhanced order and booking classes to manage safety seal attachment and retrieval. - Added tests to validate safety seal functionality in order processing.
38 lines
814 B
PHP
38 lines
814 B
PHP
<?php
|
|
|
|
namespace classes;
|
|
|
|
/**
|
|
* Ensures additive schema for orders metadata.
|
|
*/
|
|
class orders_schema_bootstrap
|
|
{
|
|
private static bool $initialized = false;
|
|
|
|
public static function ensureTables(): void
|
|
{
|
|
if (self::$initialized) {
|
|
return;
|
|
}
|
|
|
|
global $db;
|
|
|
|
if (!isset($db) || !is_object($db) || !method_exists($db, 'query')) {
|
|
return;
|
|
}
|
|
|
|
$db->query(
|
|
"ALTER TABLE orders
|
|
ADD COLUMN IF NOT EXISTS include_in_invoice TINYINT(1) NULL DEFAULT NULL
|
|
AFTER created_at"
|
|
);
|
|
$db->query(
|
|
"ALTER TABLE orders
|
|
ADD COLUMN IF NOT EXISTS safety_seal VARCHAR(255) NULL DEFAULT NULL
|
|
AFTER po"
|
|
);
|
|
|
|
self::$initialized = true;
|
|
}
|
|
}
|