Some checks failed
Deploy to production / deploy (push) Has been cancelled
- Modified the deployment workflow to include new migration paths for the backend, ensuring that migrations are correctly referenced in the deployment process. - Updated the `db:migrate` script in package.json to point to the `migrations-active` directory, enhancing clarity and organization of migration files. - Adjusted the deployment conditions to account for changes in migration file locations, improving the accuracy of change detection during deployments. - Removed obsolete migration files to streamline the migration process and prevent confusion.
81 lines
4.1 KiB
SQL
81 lines
4.1 KiB
SQL
-- Baseline: archivierte Sequelize-Migrationen als „bereits ausgeführt“ markieren
|
||
-- ---------------------------------------------------------------------------
|
||
-- Kontext: Ab diesem Stand nutzt `npm run db:migrate` nur noch `migrations-active/`.
|
||
-- Die bisherigen Dateien liegen unter `migrations-archive/` und werden nicht mehr
|
||
-- vom CLI ausgeführt. In bestehenden Datenbanken sind viele Einträge in
|
||
-- "SequelizeMeta" schon vorhanden; fehlende werden hier ergänzt.
|
||
--
|
||
-- Wann: Einmal VOR dem ersten Deploy ausführen, der nur noch `migrations-active`
|
||
-- verwendet (oder direkt nach dem Ausrollen dieses Commits, bevor/neben
|
||
-- dem nächsten `db:migrate`).
|
||
--
|
||
-- Idempotent: Bereits vorhandene Namen werden übersprungen (WHERE NOT EXISTS).
|
||
--
|
||
-- Nicht für leere/neue Datenbanken: Dort das Schema über die archivierten
|
||
-- Migrationen oder euren üblichen Init-Weg aufbauen – diese Baseline ersetzt
|
||
-- keine fehlenden DDL-Schritte.
|
||
--
|
||
-- Wo liegt SequelizeMeta?
|
||
-- Gleiche PostgreSQL-Datenbank wie das Backend (DB_NAME), in der Regel Schema
|
||
-- `public`. Sequelize/sequelize-cli legen die Tabelle beim ersten Lauf von
|
||
-- `db:migrate` an. Fehlt sie, bist du oft in der falschen DB verbunden oder
|
||
-- es lief noch nie eine Migration gegen diese DB.
|
||
-- Prüfen: SELECT schemaname, tablename FROM pg_tables
|
||
-- WHERE tablename IN ('SequelizeMeta','sequelizemeta');
|
||
|
||
CREATE TABLE IF NOT EXISTS "SequelizeMeta" (
|
||
name VARCHAR(255) NOT NULL PRIMARY KEY
|
||
);
|
||
|
||
INSERT INTO "SequelizeMeta" (name)
|
||
SELECT v.name FROM (VALUES
|
||
('20240913071145-add-answer-fields-to-contact_message.cjs'),
|
||
('20251126120000-add-last-nobility-advance-to-falukant-user.cjs'),
|
||
('20251208000000-add-character-name-to-notification.cjs'),
|
||
('20251216000000-add-weather-type-to-production.cjs'),
|
||
('20251216000100-add-product-quality-to-stock.cjs'),
|
||
('20251220000000-add-reputation-to-character.cjs'),
|
||
('20251220001000-add-reputation-actions.cjs'),
|
||
('20251220002000-backfill-reputation-action-window.cjs'),
|
||
('20251220003000-seed-reputation-actions.cjs'),
|
||
('20251222000000-fix-vehicle-condition-null.cjs'),
|
||
('20251222001000-add-may-repair-vehicles-to-director.cjs'),
|
||
('20251230000000-add-vocab-trainer-tables.cjs'),
|
||
('20251230001000-add-vocab-chapters-and-lexemes.cjs'),
|
||
('20260101000000-add-tax-percent-to-region.cjs'),
|
||
('20260101000002-add-neutral-sell-costs-to-product.cjs'),
|
||
('20260115000000-add-vocab-courses.cjs'),
|
||
('20260115000001-add-vocab-grammar-exercises.cjs'),
|
||
('20260115000002-add-course-structure.cjs'),
|
||
('20260115000003-add-course-learning-goals.cjs'),
|
||
('20260118000000-add-notification-user-shown-index.cjs'),
|
||
('20260320000000-add-relationship-state-and-child-legitimacy.cjs'),
|
||
('20260320001000-backfill-relationship-state.cjs'),
|
||
('20260320002000-add-servants-to-user-house.cjs'),
|
||
('20260323000000-add-household-tension-to-user-house.cjs'),
|
||
('20260323010000-expand-debtors-prism.cjs'),
|
||
('20260323020000-add-transport-guards-and-raid-underground.cjs'),
|
||
('20260325000000-add-vocab-lesson-didactics.cjs'),
|
||
('20260325010000-expand-user-param-value-to-text.cjs'),
|
||
('20260326000000-add-adult-area-to-gallery.cjs'),
|
||
('20260326001000-create-erotic-video.cjs'),
|
||
('20260326002000-add-is-adult-only-to-chat-room.cjs'),
|
||
('20260326003000-add-adult-content-moderation.cjs'),
|
||
('20260327000000-add-erotic-video-visibility.cjs'),
|
||
('20260330000000-add-character-pregnancy.cjs'),
|
||
('20260331000000-add-vocab-lesson-phase1-fields.cjs'),
|
||
('20260401000000-add-vocab-course-progress-lesson-state.cjs'),
|
||
('20260401120000-politics-benefits-and-daily-salary.cjs'),
|
||
('20260402120000-add-ui-locale-fr-user-param-value.cjs'),
|
||
('20260402140000-add-certificate-productions-count-since.cjs'),
|
||
('20260402180000-political-benefits-mechanics.cjs'),
|
||
('20260403120000-political-office-hierarchy-level.cjs'),
|
||
('20260413152500-add-relationship-state-scandal-extra-daily-pct.cjs'),
|
||
('20260413190000-add-relationship-state-marriage-satisfaction-column.cjs'),
|
||
('20260417000000-add-vocab-srs-item.cjs'),
|
||
('add_trigger_for_hashedId.cjs')
|
||
) AS v(name)
|
||
WHERE NOT EXISTS (
|
||
SELECT 1 FROM "SequelizeMeta" m WHERE m.name = v.name
|
||
);
|