Skip to content

chore(l12): drop Doctrine schema calls and add a guarded tokens migration - #332

Merged
roncodes merged 1 commit into
release/v2.0.0from
chore/l12-schema-prep
Nov 6, 2026
Merged

roncodes merged 1 commit into
release/v2.0.0from
chore/l12-schema-prep

Conversation

@roncodes

@roncodes roncodes commented Nov 5, 2026

Copy link
Copy Markdown
Member

Prepares core-api for the Laravel 12 upgrade while still running on Laravel 10. The upgrade itself is not in this PR.

Changes

  • Doctrine and Schema::getAllTables() removed. ForceResetDatabase, InitializeSandboxKeyColumn, ApiCredentialController, DataPurger and SqlDumper now list tables through Schema::getTables(). The indexExists() helpers in two migrations use Schema::getIndexes().
  • DataPurger catalog fallback fixed. It now aliases table_name, because the lower-case column name fails on MySQL 8. Laravel 12 would have reached this path.
  • New guarded personal_access_tokens migration. Sanctum 4 stops loading its own migrations, and fix_personal_access_tokens needs the table. The new migration sorts after Sanctum 3's and does nothing where the table exists. down() is deliberately empty so a rollback can't delete live tokens.
  • reports.average_execution_time pinned to DOUBLE(8,2) in SQL. Blueprint::float() stops defaulting to total and places on Laravel 11+.

Decisions to check

  • Sandbox: the new migration skips the sandbox database. sandbox:migrate only runs package paths, so sandbox has never had this table, and fix_personal_access_tokens skips it too. The sandbox migrations table does gain one row for it.
  • Cache prefix: not changed here. Laravel 10's Redis, Memcached and DynamoDB stores already append :, so adding it now would give :: and move every key. It belongs in the Laravel 12 commit, with a cache flush at cutover. CACHE_PREFIX and the explode(':')[1] in Utils.php need checking at the same time.
  • Minimum Laravel version: Schema::getTables() and getIndexes() need Laravel 10.37, while composer.json still allows ^9|^10. The constraint should be tightened in the upgrade.
  • Branch name: the target is release/v2.0.0, as planned for the upgrade. The next minor from 1.6.74 would be 1.7.0.

Verification

Fresh migrate on MySQL 8.0 and Laravel 10.50, comparing SHOW CREATE TABLE dumps across the live, sandbox and storefront databases:

  • main vs this branch, with Doctrine: no differences.
  • main vs this branch, with DBAL hidden, native schema operations and Sanctum's migrations off: only COMMENT '(DC2Type:guid)' on 6 columns. That comment is a Doctrine artifact and can't be restated on Laravel 10 without doubling it.
  • Upgrade from a main database: no schema changes, and the new migration is a no-op.
  • Old vs new table and index listings on a live schema: identical across 387 tables and 3513 indexes.
  • Tests: the suite passes with 100% coverage. After the reports column change, I re-ran only ReportExecutionColumnsTest, which loads that migration, and it passes.

Not tested: down() methods, and a real Laravel 12 install. The Laravel 10 simulation can't detect Blueprint signature changes, so the float differences came from a separate Laravel 12 spike.

…tion

List tables and indexes through the schema builder, which Laravel 10.37+ and 12
both provide. Replace the removed Schema::getAllTables() fallbacks and alias the
DataPurger catalog query, whose lower-case column name fails on MySQL 8.

Sanctum 4 stops loading its migrations, so add a create migration that sorts
after Sanctum 3's and before fix_personal_access_tokens. It is a no-op where the
table exists and on the sandbox database, which has never had it.

Set reports.average_execution_time to DOUBLE(8,2) in SQL, since Blueprint::float()
stops defaulting to total and places on Laravel 11+.
@roncodes
roncodes merged commit 68471ab into release/v2.0.0 Nov 6, 2026
1 of 3 checks passed
@roncodes
roncodes deleted the chore/l12-schema-prep branch November 6, 2026 02:36
@roncodes roncodes mentioned this pull request Nov 6, 2026
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.

1 participant