database migrations

This commit is contained in:
irrlicht
2026-09-07 12:40:12 +02:00
parent c42db46973
commit 861caae57c
2 changed files with 154 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
-- Migration p2-000: Buch ueber angewandte Migrationen
--
-- psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -f migrations/p2-000-migrationsbuch.sql
--
-- Dev und Prod teilen dasselbe Schema; abweichende Staende sind der Weg, auf
-- dem sich das aendert, ohne dass es jemand merkt. Diese Tabelle macht den
-- Stand abfragbar. Sie traegt das Praefix p2-, weil die Ingest-Migrationen
-- (swp-01-ingest/migrations) eine eigene Zaehlung haben und beide auf
-- dieselbe Datenbank laufen.
begin;
create table if not exists schema_migrationen (
name text primary key, -- Dateiname ohne .sql
angewandt_am timestamptz not null default now(),
notiz text
);
comment on table schema_migrationen is
'Nachtraeglich gepflegt: Ingest-Migrationen 001/002 liefen vor dieser Tabelle';
insert into schema_migrationen (name, notiz) values
('p2-000-migrationsbuch', null)
on conflict (name) do nothing;
commit;