add system dependency checks (php-curl, sqlite3) to deploy-server.sh step 0

This commit is contained in:
Pontoporeia
2026-05-11 16:03:37 +02:00
parent 31ccbd195b
commit 3ae22cd427
3 changed files with 45 additions and 1 deletions

View File

@@ -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');

View File

@@ -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;