Skip to content

fix(scripts): lokale Dev-Seed-Scripts von MSSQL auf PostgreSQL portieren#3982

Open
TaprootFreak wants to merge 1 commit into
developfrom
fix/seed-scripts-postgres
Open

fix(scripts): lokale Dev-Seed-Scripts von MSSQL auf PostgreSQL portieren#3982
TaprootFreak wants to merge 1 commit into
developfrom
fix/seed-scripts-postgres

Conversation

@TaprootFreak

Copy link
Copy Markdown
Collaborator

Was

Portiert die lokalen Dev-Seed-Scripts unter scripts/ von SQL Server (mssql-Treiber + T-SQL) auf PostgreSQL (pg) — konsistent mit der bereits portierten setup.js (#3838).

Betroffen:

  • scripts/testdata.js
  • scripts/kyc/kyc-testdata.js
  • scripts/kyc/kyc-storage.js
  • scripts/kyc/upload-kyc-files.js (DB-Teil getKycCodes)

scripts/kyc/upload-kyc-files.sh brauchte keine Änderung.

Dialekt-Port (MSSQL → PostgreSQL)

  • mssqlpg (Client statt Pool, Port 1433 → 5432)
  • benannte .input()-Params → positionale $1..$N; recordsetrows
  • OUTPUT INSERTED.idRETURNING id; SELECT TOP 1LIMIT 1; GETUTCDATE()now() at time zone 'utc'
  • camelCase-Identifier doppelt gequotet ("userDataId" …); [user]/[transaction]"user"/"transaction"
  • Boolean-Vergleich receive = true statt = 1

Mitgefixte vorbestehende Schema-Bugs

Damit die Scripts auf PostgreSQL tatsächlich durchlaufen (Ziel des Issues), wurden drei Schema-Inkompatibilitäten korrigiert, die bereits im MSSQL-Original vorhanden waren:

  • testdata.js: bank_tx-INSERT referenzierte die nicht existierende Spalte bankId → entfernt; die NOT-NULL-Spalte accountServiceRef fehlte → ergänzt (unique uuid)
  • kyc-testdata.js: kyc_log-INSERT liess die NOT-NULL-Spalten type (STI-Discriminator) und userDataId aus → ergänzt

Validierung

Echter Lauf gegen eine frische PostgreSQL-DB (Schema + Referenzdaten):

  • testdata.js: vollständig durch — user_data 5, user 5, buy 4, bank_data 3, deposit 3, transaction 6, bank_tx 3, kyc_step 20, kyc_log 32
  • kyc-testdata.js: vollständig durch — kyc_step/kyc_file/kyc_log
  • kyc-storage.js: läuft (read-only JOIN)
  • Projekt-format:check / type-check / lint grün; node --check aller Dateien grün

Closes #3965

@TaprootFreak TaprootFreak marked this pull request as ready for review June 26, 2026 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local dev seed scripts still use the mssql driver and T-SQL (broken after Postgres migration)

1 participant