From 3ae22cd42737e06142898560dbc1df9d3be60492 Mon Sep 17 00:00:00 2001 From: Pontoporeia Date: Mon, 11 May 2026 16:03:37 +0200 Subject: [PATCH] add system dependency checks (php-curl, sqlite3) to deploy-server.sh step 0 --- .../applied/019_add_ecriture_format.sql | 2 +- .../pending/033_dedup_format_types.sql | 31 +++++++++++++++++++ app/templates/admin/acces.php | 13 ++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 app/migrations/pending/033_dedup_format_types.sql diff --git a/app/migrations/applied/019_add_ecriture_format.sql b/app/migrations/applied/019_add_ecriture_format.sql index 55d565e..5d59dc3 100644 --- a/app/migrations/applied/019_add_ecriture_format.sql +++ b/app/migrations/applied/019_add_ecriture_format.sql @@ -1,2 +1,2 @@ -- Migration 019: Add "Écriture" format type -INSERT INTO format_types (name) VALUES ('Écriture'); +INSERT OR IGNORE INTO format_types (name) VALUES ('Écriture'); diff --git a/app/migrations/pending/033_dedup_format_types.sql b/app/migrations/pending/033_dedup_format_types.sql new file mode 100644 index 0000000..8997668 --- /dev/null +++ b/app/migrations/pending/033_dedup_format_types.sql @@ -0,0 +1,31 @@ +-- Migration 033: Deduplicate format_types rows (caused by repeated runs of migration 019). +-- For each name, keep the row with the lowest id, reassign thesis_formats references. + +-- 1. Map each duplicate format_id → canonical format_id +CREATE TEMP TABLE _fmt_map AS +SELECT + dup.id AS old_id, + ( + SELECT MIN(keep.id) + FROM format_types keep + WHERE keep.name = dup.name + ) AS new_id +FROM format_types dup +WHERE dup.id != ( + SELECT MIN(keep.id) + FROM format_types keep + WHERE keep.name = dup.name +); + +-- 2. Update affected thesis_formats rows +UPDATE thesis_formats +SET format_id = ( + SELECT new_id FROM _fmt_map WHERE old_id = format_id +) +WHERE format_id IN (SELECT old_id FROM _fmt_map); + +-- 3. Delete duplicate rows +DELETE FROM format_types +WHERE id IN (SELECT old_id FROM _fmt_map); + +DROP TABLE _fmt_map; diff --git a/app/templates/admin/acces.php b/app/templates/admin/acces.php index ea3f2f5..4cd1039 100644 --- a/app/templates/admin/acces.php +++ b/app/templates/admin/acces.php @@ -1351,6 +1351,19 @@ +%%%%%%% diff from: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision) +\\\\\\\ to: rmlpyuwp b77b7e1c "add syntaqlite SQL validation to migrate.sh before applying schema.sql" (rebased revision) ++ $linkName = $link['name'] ?? ''; +++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff from: rmlpyuwp b77b7e1c "add syntaqlite SQL validation to migrate.sh before applying schema.sql" (rebased revision) +\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ to: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision) +- $linkName = $link['name'] ?? ''; +- $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff from: somsyvxz 14a3cd10 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebase destination) +\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ to: vmzyzsnu 24d58f2e "add system dependency checks (php-curl, sqlite3) to deploy-server.sh step 0" (rebased revision) + $linkName = $link['name'] ?? ''; + $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; + $linkLockedYear = $link['locked_year'] ?? null; ++%%%%%%% diff from: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision) ++\\\\\\\ to: vmzyzsnu 1f8d1d73 "add system dependency checks (php-curl, sqlite3) to deploy-server.sh step 0" (rebased revision) +++ $linkName = $link['name'] ?? ''; ++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; ?>