Refactor scheduler and settings UI

This commit is contained in:
Mikhail Chusavitin
2026-03-07 21:10:20 +03:00
parent 27e33db446
commit b2b2f4774c
23 changed files with 1601 additions and 551 deletions

View File

@@ -0,0 +1,50 @@
-- Drop unused BOM storage introduced earlier but never adopted in runtime code.
SET @fk_cfg_bom_exists := (
SELECT COUNT(*)
FROM information_schema.REFERENTIAL_CONSTRAINTS
WHERE CONSTRAINT_SCHEMA = DATABASE()
AND CONSTRAINT_NAME = 'fk_qt_configurations_bom'
);
SET @fk_cfg_bom_sql := IF(
@fk_cfg_bom_exists > 0,
'ALTER TABLE qt_configurations DROP FOREIGN KEY fk_qt_configurations_bom',
'SELECT 1'
);
PREPARE stmt_drop_cfg_bom_fk FROM @fk_cfg_bom_sql;
EXECUTE stmt_drop_cfg_bom_fk;
DEALLOCATE PREPARE stmt_drop_cfg_bom_fk;
SET @idx_cfg_bom_exists := (
SELECT COUNT(*)
FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'qt_configurations'
AND INDEX_NAME = 'idx_qt_configurations_bom_id'
);
SET @idx_cfg_bom_sql := IF(
@idx_cfg_bom_exists > 0,
'ALTER TABLE qt_configurations DROP INDEX idx_qt_configurations_bom_id',
'SELECT 1'
);
PREPARE stmt_drop_cfg_bom_idx FROM @idx_cfg_bom_sql;
EXECUTE stmt_drop_cfg_bom_idx;
DEALLOCATE PREPARE stmt_drop_cfg_bom_idx;
SET @col_cfg_bom_exists := (
SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'qt_configurations'
AND COLUMN_NAME = 'bom_id'
);
SET @col_cfg_bom_sql := IF(
@col_cfg_bom_exists > 0,
'ALTER TABLE qt_configurations DROP COLUMN bom_id',
'SELECT 1'
);
PREPARE stmt_drop_cfg_bom_col FROM @col_cfg_bom_sql;
EXECUTE stmt_drop_cfg_bom_col;
DEALLOCATE PREPARE stmt_drop_cfg_bom_col;
DROP TABLE IF EXISTS qt_bom;

View File

@@ -0,0 +1,9 @@
CREATE TABLE IF NOT EXISTS qt_scheduler_runs (
job_name VARCHAR(100) NOT NULL,
last_started_at DATETIME NULL,
last_finished_at DATETIME NULL,
last_status VARCHAR(20) NOT NULL DEFAULT 'idle',
last_error TEXT NULL,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (job_name)
);