Skip to content

Fix the schema to one shape and use Eloquent models as the data layer - #13

Merged
imanimanyara merged 4 commits into
mainfrom
refactor/fixed-schema-and-models
Nov 10, 2026
Merged

imanimanyara merged 4 commits into
mainfrom
refactor/fixed-schema-and-models

Conversation

@imanimanyara

Copy link
Copy Markdown
Member

Summary

Two design changes approved before the first release:

  • Fixed schema. The migration creates every table, always, in one shape:
    • ULID keys, a string owner key, identity unique on (tenant, scope, key, locale) plus a uid, and translations stored as JSON.
    • tenancy.mode is the only switch: column adds the tenant columns and keys.
    • Table names stay configurable.
    • The recorded schema-shape file and the pairwise/full schema matrix are gone. doctor checks the real columns.
    • The CI matrix job is now a tenancy matrix.
  • Models as the data layer. Categories, definitions, audit, history and change requests go through Eloquent models: new SettingHistory and SettingChangeRequest, with tenant scoping in one BelongsToTenant trait and global scope, and table names defined once. The five overlapping repositories are removed. The per-request value load in DatabaseDriver stays on the query builder for speed.

Removed config keys

schema.path, identity.mode, ids.type, ids.owner_key, translations.mode, categories.soft_deletes, definitions.table, history.enabled and approvals.table.

Behaviour changes

  • Category ids are ULIDs (they were integers by default). Titles are stored as JSON. Value rows have no slug.
  • History is always recorded for a store with a database layer.
  • definitions.sources defaults to code and config. Reading definitions from the database is opt-in, so cached reads stay at zero queries.
  • Definition sync touches updated_at only when a row changes.

Verification (local, SQLite)

  • Pest: 623 passed (680 before; the removed tests covered the removed switches); coverage 96.9 %.
  • PHPStan, Rector, Pint and composer audit: clean.
  • MySQL and Postgres run in CI.

Copilot AI balanced review requested due to automatic review settings November 10, 2026 20:30

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 was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@imanimanyara
imanimanyara merged commit 26f70ad into main Nov 10, 2026
14 checks passed
@imanimanyara
imanimanyara deleted the refactor/fixed-schema-and-models branch November 11, 2026 17:52
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.

2 participants