Diff -- /var/www/vhosts/3dshawn.com/site1/_schema/drift_sense_wave5.sql

O Operator
Diff

/var/www/vhosts/3dshawn.com/site1/_schema/drift_sense_wave5.sql

deleted on local at 2026-07-12 01:52:02

Added
+0
lines
Removed
-55
lines
Context
0
unchanged
Blobs
from f7559ca0d3ba
to
Unified diff
Naive LCS-based line diff. Additions in emerald, deletions in rose. Both sides decompressed live from BLOB_STORE.
1-- DriftSense wave 5 -- version tiers, compile check, trends
2
3DELIMITER $$
4DROP PROCEDURE IF EXISTS _drift_add_col $$
5CREATE PROCEDURE _drift_add_col(IN t_name VARCHAR(64), IN c_name VARCHAR(64), IN c_ddl VARCHAR(500))
6BEGIN
7 IF NOT EXISTS (
8 SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS
9 WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = t_name AND COLUMN_NAME = c_name
10 ) THEN
11 SET @sql = CONCAT('ALTER TABLE ', t_name, ' ADD COLUMN ', c_name, ' ', c_ddl);
12 PREPARE stmt FROM @sql;
13 EXECUTE stmt;
14 DEALLOCATE PREPARE stmt;
15 END IF;
16END $$
17DELIMITER ;
18
19-- Release tier: makes "stable" points prominent + easy to find/restore.
20-- 'stable' = production-ready checkpoint you'd roll back to
21-- 'working' = milestone you've verified but might revise
22-- 'draft' = plain bookmark (default, existing behavior)
23CALL _drift_add_col('NAMED_RELEASES', 'tier',
24 "ENUM('draft','working','stable') NOT NULL DEFAULT 'draft'");
25CALL _drift_add_col('NAMED_RELEASES', 'version_label',
26 'VARCHAR(60) DEFAULT NULL');
27
28-- Compile check results cached on the blob itself. NULL = never checked.
29CALL _drift_add_col('BLOB_STORE', 'compile_status',
30 "ENUM('ok','error','unknown','unchecked') DEFAULT NULL");
31CALL _drift_add_col('BLOB_STORE', 'compile_language', 'VARCHAR(20) DEFAULT NULL');
32CALL _drift_add_col('BLOB_STORE', 'compile_message', 'TEXT DEFAULT NULL');
33CALL _drift_add_col('BLOB_STORE', 'compile_checked_at', 'DATETIME DEFAULT NULL');
34
35-- Bulk-scope named releases (Wave 5 F5): a release can cover multiple
36-- monitor scopes at once. When empty, we fall back to the single
37-- scope_monitor_id / scope_server_id columns.
38CREATE TABLE IF NOT EXISTS NAMED_RELEASE_SCOPES (
39 scope_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
40 named_release_id INT UNSIGNED NOT NULL,
41 file_monitor_list_id INT UNSIGNED DEFAULT NULL,
42 server_id INT UNSIGNED DEFAULT NULL,
43 PRIMARY KEY (scope_id),
44 KEY idx_release (named_release_id),
45 KEY idx_monitor (file_monitor_list_id),
46 KEY idx_server (server_id)
47) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
48
49-- Alerts: email delivery kind
50-- We can't ALTER an ENUM idempotently in a portable way; the app
51-- accepts 'email' via delivery_kind if present. If your MariaDB
52-- already has 'email' in the enum this is a no-op.
53-- (Deferred: enum widening handled at app layer.)
54
55DROP PROCEDURE _drift_add_col;