Skip to content

v2.2.0: Dynamic Schema Extension + Custom Field CLI#17

Merged
vedavith merged 4 commits into
mainfrom
2.2.0
Jul 1, 2026
Merged

v2.2.0: Dynamic Schema Extension + Custom Field CLI#17
vedavith merged 4 commits into
mainfrom
2.2.0

Conversation

@vedavith

@vedavith vedavith commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds Dynamic Schema Extension: opt-in "metadata": true flag in entity JSON schema emits a metadata JSON NULL column and getMeta/setMeta/getAllMeta methods on BaseRepository
  • Adds tenant_fields registry table (auto-created by CoreSchemaManager) to store per-tenant custom field definitions
  • Adds TenantFieldRegistry class for CRUD on field definitions, scoped by tenant ID
  • Adds three new CLI commands: field:add, field:list, field:remove
  • Adds Packagist metadata to composer.json (keywords, homepage, authors)
  • Documents Dynamic Schema Extension in README with full usage examples

Test plan

  • vendor/bin/phpunit passes green
  • vendor/bin/phpstan analyse clean at level 8
  • php bin/ef field:add accounts vat_number string --tenant=beta --label="VAT Number" registers field
  • php bin/ef field:list accounts --tenant=beta lists registered field
  • php bin/ef field:remove 1 --tenant=beta removes field
  • getMeta / setMeta / getAllMeta work on a metadata-enabled entity
  • Both shared and database tenancy strategies work with metadata

vedavith added 3 commits June 29, 2026 08:00
- Add "metadata": true flag to entity JSON schemas
- MigrationBuilder emits metadata JSON NULL column when flagged
- EntityBuilder emits public ?array $metadata = null; property when flagged
- SchemaValidator validates metadata is boolean
- BaseRepository: getMeta, setMeta, getAllMeta with assertMetaKey guard
- CoreSchemaManager: auto-creates tenant_fields table on boot
- TenantFieldRegistry: register, fieldsFor, remove, validate for per-tenant custom field definitions
- Full test coverage for all new behaviour
Register, list, and remove per-tenant custom field definitions
from the command line using TenantFieldRegistry.
- Add keywords, homepage, and author to composer.json for Packagist discoverability
- Remove "publication pending" note from README (package is ready to publish)
- Add field:add, field:list, field:remove to CLI reference table
- Add Dynamic Schema Extension section with usage examples
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

- FieldListCommand: cover required-label branch and catch block
- FieldRemoveCommand: cover catch block on registry exception
- TenantFieldRegistry: cover float/bool/unknown assertValueType branches
@vedavith vedavith merged commit 6e6c7a1 into main Jul 1, 2026
6 checks passed
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