From 250139598c625b2465a887f52a83c8668ffeeab5 Mon Sep 17 00:00:00 2001 From: Deeman Date: Fri, 27 Feb 2026 07:35:50 +0100 Subject: [PATCH] feat: migration 0020 group_key + move state-of-padel to reports/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Migration 0020: add group_key TEXT column + index to articles table - DELETE state-of-padel rows from articles (slug collision, moving to reports) - git mv state-of-padel-q1-2026-{en,de}.md → data/content/reports/ Co-Authored-By: Claude Sonnet 4.6 --- .../state-of-padel-q1-2026-de.md | 0 .../state-of-padel-q1-2026-en.md | 0 .../versions/0020_articles_group_key.py | 24 +++++++++++++++++++ 3 files changed, 24 insertions(+) rename data/content/{articles => reports}/state-of-padel-q1-2026-de.md (100%) rename data/content/{articles => reports}/state-of-padel-q1-2026-en.md (100%) create mode 100644 web/src/padelnomics/migrations/versions/0020_articles_group_key.py diff --git a/data/content/articles/state-of-padel-q1-2026-de.md b/data/content/reports/state-of-padel-q1-2026-de.md similarity index 100% rename from data/content/articles/state-of-padel-q1-2026-de.md rename to data/content/reports/state-of-padel-q1-2026-de.md diff --git a/data/content/articles/state-of-padel-q1-2026-en.md b/data/content/reports/state-of-padel-q1-2026-en.md similarity index 100% rename from data/content/articles/state-of-padel-q1-2026-en.md rename to data/content/reports/state-of-padel-q1-2026-en.md diff --git a/web/src/padelnomics/migrations/versions/0020_articles_group_key.py b/web/src/padelnomics/migrations/versions/0020_articles_group_key.py new file mode 100644 index 0000000..dfa2bfb --- /dev/null +++ b/web/src/padelnomics/migrations/versions/0020_articles_group_key.py @@ -0,0 +1,24 @@ +"""Add group_key column to articles for cross-language static article grouping. + +Static cornerstone articles (e.g. padel-hall-cost-guide EN vs padel-halle-kosten DE) +have different url_paths per language, so they cannot be grouped by url_path alone. +The group_key (populated from the `cornerstone` frontmatter field, e.g. 'C2') is a +shared key that pairs EN/DE variants of the same static article. + +pSEO articles leave group_key NULL and continue to group by url_path (unchanged). + +Also removes any state-of-padel articles that are being moved to the reports flow. +""" + + +def up(conn): + conn.execute( + "ALTER TABLE articles ADD COLUMN group_key TEXT DEFAULT NULL" + ) + conn.execute( + "CREATE INDEX IF NOT EXISTS idx_articles_group_key" + " ON articles(group_key)" + ) + # Remove state-of-padel rows — these are moving to the reports flow + # and would cause slug collisions (both EN/DE use slug 'state-of-padel-q1-2026') + conn.execute("DELETE FROM articles WHERE slug LIKE 'state-of-padel%'")