Skip to content

Fix validation for multi-table CREATE migrations - #167

Merged
itshypax merged 3 commits into
mainfrom
copilot/fix-database-migration-error
Nov 21, 2025
Merged

Fix validation for multi-table CREATE migrations#167
itshypax merged 3 commits into
mainfrom
copilot/fix-database-migration-error

Conversation

Copilot AI commented Nov 21, 2025

Copy link
Copy Markdown
Contributor

The migration create_intra_support_db_28102025.php creates three tables but validation was checking for a non-existent table name extracted from the filename (intra_support_db), causing false failures during composer install --no-dev.

Changes

  • Migration metadata: Added optional tables array parameter to migration entries for explicit table specification
  • Validation logic: Check all tables in tables array when present; fallback to filename extraction for single-table migrations
  • Code quality: Extracted duplicate error formatting into throwTableCreationError() helper function

Example

// Before: validation failed because 'intra_support_db' table doesn't exist
['file' => 'create_intra_support_db_28102025.php', 'type' => 'create'],

// After: validates the three actual tables created
['file' => 'create_intra_support_db_28102025.php', 'type' => 'create', 
 'tables' => ['intra_support_passwords', 'intra_support_sessions', 'intra_support_actions_log']],

The fix is backward compatible—existing single-table migrations continue using filename-based extraction.

Original prompt

This section details on the original issue you should resolve

<issue_title>Probleme mit Datenbank-Migration</issue_title>
<issue_description>Hey Hey, ich wollte das ganze mal ausprobieren, weil es eigentlich ganz interessant aussieht, aber ich komme bei der Installation nicht weiter. Ich mache es 1:1 wie in der Anleitung beschrieben, hab alle Dependencys installier bekomme aber bei "composer install --no-dev" immer folgenden Error am Ende (Bis dahin läuft alles ohne Probleme):

▶️
Klicken, um mehr zu erfahren
Führe aus [create]: create_intra_support_db_28102025.php


Klicken, um mehr zu erfahren
Fehlgeschlagen: create_intra_support_db_28102025.php
Fehler: Table 'intra_support_db' was not created successfully. Existing tables: intra_antraege, intra_antraege_daten, intra_antrag_felder, intra_antrag_typen, intra_audit_log, intra_dashboard_categories, intra_dashboard_tiles, intra_dokument_template_fields, intra_dokument_templates, intra_edivi, intra_edivi_prereg, intra_edivi_qmlog, intra_edivi_vitalparameter_einzelwerte, intra_edivi_ziele, intra_fahrzeuge, intra_fahrzeuge_beladung_categories, intra_fahrzeuge_beladung_tiles, intra_migrations, intra_mitarbeiter, intra_mitarbeiter_dienstgrade, intra_mitarbeiter_dokumente, intra_mitarbeiter_fdquali, intra_mitarbeiter_fwquali, intra_mitarbeiter_log, intra_mitarbeiter_rdquali, intra_support_actions_log, intra_support_passwords, intra_support_sessions, intra_users, intra_users_roles

⚠️
Klicken, um mehr zu erfahren
Kritischer Fehler bei create-Migration. Abbruch.
Bitte überprüfen Sie:

Datenbankberechtigungen (CREATE, ALTER, INDEX Rechte)
MySQL/MariaDB Version und Kompatibilität,
Verfügbarer Speicherplatz,
MySQL-Fehlerlog für detaillierte Fehlermeldungen,
,

Script @php setup/database-init.php handling the db:migrate event returned with error code 1
Script @db:migrate was called via post-install-cmd
root@emergencyforge:/var/www/intraRP#

Nicht wundern, teste es in einem Debian LXC auf meinem Proxmox Host </issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits November 21, 2025 13:45
Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix database migration issue with install Fix validation for multi-table CREATE migrations Nov 21, 2025
Copilot AI requested a review from itshypax November 21, 2025 13:51
@itshypax
itshypax marked this pull request as ready for review November 21, 2025 14:26
@itshypax
itshypax merged commit 1b4ced7 into main Nov 21, 2025
2 checks passed
@itshypax
itshypax deleted the copilot/fix-database-migration-error branch November 21, 2025 14:27
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.

Probleme mit Datenbank-Migration

2 participants