Skip to content

fix(migrations): make installation work on MySQL and keep app translations - #97

Merged
jfrosorio merged 6 commits into
masterfrom
fix-93
Sep 25, 2026
Merged

jfrosorio merged 6 commits into
masterfrom
fix-93

Conversation

@jfrosorio

Copy link
Copy Markdown
Contributor

Closes #93.

Fixes the problems a user hits while installing the package, before any payment is made.

  • The PaysafeCard and Credit Card migrations now give their morph indexes short explicit names. The generated names were 68 and 66 characters, over MySQL's 64-character limit, so migrate failed after creating the table and blocked every later migration.
  • The migration that changes mbway_references.value to decimal is skipped on SQLite, where it needed doctrine/dbal on Laravel 10. Fresh installs already create the column as decimal.
  • Translations publish to lang_path('vendor/eupago'). Publishing to resources/lang created that directory and made Laravel stop loading the app's own lang/ translations.
  • New package-prefixed publish tags (eupago-migrations, eupago-config, eupago-translations); the old tags keep working.
  • Docs: each payment-method page sets up the trait before the first example that needs it, the (new MB(...))->create() sample is fixed, and the Multibanco result lists all its keys.
  • UPGRADE.md covers recovering a MySQL install that already hit the failed migration, and moving translations published to the old location.

Verified on a MySQL 8 container: v3.9.0 fails with "Identifier name ... is too long", this branch migrates and rolls back cleanly, and the recovery steps in UPGRADE.md repair a database left broken by the old migration. tests/Feature/PublishingTest.php covers the tags, the translations path and the 64-character index limit.

Copilot AI lite review requested due to automatic review settings September 25, 2026 22:53
@jfrosorio jfrosorio self-assigned this Sep 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The changes directly address the reported installation failures with targeted fixes and add tests to prevent regressions for publish tags, translation paths, and index name length constraints.

Review effort: Lite
Findings: None

What changed in this PR

This PR fixes several installation-time problems in the package by making migrations compatible with MySQL identifier limits, avoiding an SQLite-only migration failure on Laravel 10, and correcting translation publishing so it doesn’t override an app’s own lang/ directory translations.

Changes:

  • Add explicit, shorter morph index names in PaysafeCard and Credit Card migrations to stay under MySQL/MariaDB’s 64-character identifier limit.
  • Skip the mbway_references.value column type alteration migration on SQLite to avoid requiring doctrine/dbal for installs/tests.
  • Publish translations to lang_path('vendor/eupago') and add package-prefixed publish tags while keeping legacy tags working; update docs and add feature tests for publishing and index-name length.
File Description
UPGRADE.md Adds upgrade/recovery guidance for previously-failed MySQL migrations and translation relocation.
tests/​Feature/​PublishingTest.php Adds coverage for publish tags, translation publish path, and index-name length constraints.
src/​Providers/​EuPagoServiceProvider.php Switches publishing to prefixed+legacy tags and publishes translations to the app lang path.
README.md Updates installation command to use the new eupago-migrations publish tag.
docs/​payshop.md Reorders trait usage before relationship examples and clarifies one-call create/save usage.
docs/​paysafecard.md Reorders trait usage before relationship examples and clarifies one-call create/save usage.
docs/​multibanco.md Reorders trait usage before relationship examples and documents additional result keys.
docs/​mbway.md Reorders trait usage before relationship examples and clarifies one-call create/save usage.
docs/​installation.md Updates publish commands to the new prefixed tags for migrations/config/translations.
docs/​credit-card.md Reorders trait usage before relationship examples and clarifies one-call create/save usage.
docs/​configuration.md Fixes the new MB(...)->create() example to valid PHP syntax.
database/​migrations/​2026_09_05_000000_create_credit_card_references_table.php Adds an explicit morph index name to avoid MySQL identifier-length failures.
database/​migrations/​2026_07_15_000000_change_mbway_references_value_to_decimal.php Skips the migration on SQLite to avoid doctrine/dbal-required column changes on Laravel 10.
database/​migrations/​2026_06_29_000000_create_paysafecard_references_table.php Adds an explicit morph index name to avoid MySQL identifier-length failures.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@jfrosorio
jfrosorio merged commit a2075d8 into master Sep 25, 2026
14 checks passed
@jfrosorio
jfrosorio deleted the fix-93 branch September 25, 2026 22:58
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.

Migrations fail on MySQL and publishing translations breaks app translations

2 participants