database migrations
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user