Skip to content

Register config fields without enumerating forms - #10

Merged
jhhazelaar merged 1 commit into
0.xfrom
b/jh/tolerate-missing-database-at-boot
Jul 13, 2026
Merged

Register config fields without enumerating forms#10
jhhazelaar merged 1 commit into
0.xfrom
b/jh/tolerate-missing-database-at-boot

Conversation

@jhhazelaar

@jhhazelaar jhhazelaar commented Jul 13, 2026

Copy link
Copy Markdown
Member

Problem

With statamic/eloquent-driver installed, bootAddon() queried the database via Form::all() on every application boot. When that database is unreachable or not yet migrated, the whole application fails to boot — which breaks package:discover, Larastan/PHPStan analysis in CI, and first deploys.

Seen in campus-coalitie CI (phpstan job): MR 405 pipeline

Error: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database.forms' doesn't exist
#13 vendor/concept7/statamic-mailerlite/src/StatamicMailerLiteServiceProvider.php(31)

Fix

Follows the same pattern as statamic-rad-pack/mailchimp:

  • The MailerLite section is registered once with the '*' wildcard (supported by FormRepository::extraConfigFor()), so boot no longer touches the forms repository at all — no database access, and one query per request less.
  • The per-form options for the mapping grid's Form field select move to a new mailer_lite_form_fields fieldtype. Its preload() resolves the form from the CP route while the configure page renders and feeds the blueprint fields to a searchable Combobox via meta. Unlike the rad-pack version this needs no extra CP route/XHR and no client-side URL parsing.
  • Stored value shape is unchanged (plain field handle string), so existing form config keeps working.

Includes regression tests: boot never calls Form::all(), wildcard section registration, and fieldtype option preloading.

With statamic/eloquent-driver installed, enumerating forms in
bootAddon() queried the database on every boot, so the application
failed to start whenever that database was unreachable or not yet
migrated (package:discover, Larastan analysis, first deploy).

The MailerLite section is now registered once with the '*' wildcard,
removing all database access from boot. The per-form field options in
the mapping grid move to a new mailer_lite_form_fields fieldtype that
resolves the form from the CP route while the configure page renders.

Changelog: fixed
@jhhazelaar
jhhazelaar force-pushed the b/jh/tolerate-missing-database-at-boot branch from 0e1bfe6 to 3a5a82b Compare July 13, 2026 17:08
@jhhazelaar jhhazelaar changed the title Tolerate missing database during boot Register config fields without enumerating forms Jul 13, 2026
@jhhazelaar
jhhazelaar merged commit 58a6707 into 0.x Jul 13, 2026
35 checks passed
@jhhazelaar
jhhazelaar deleted the b/jh/tolerate-missing-database-at-boot branch July 13, 2026 17:19
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