Skip to content

[NFR]: make:model: a schema for each table #86

Description

@niden

models.schema in crest.php gives one schema for all the tables of a project. A project with tables in more than one schema cannot use crest for all of them. A foreign key to a table in another schema gives a Skipped line, not a relation.

Scope (decided by the owner, 2026-11-27)

  • models.schema takes a string, as today, or a list of schemas, for example 'schema' => ['public', 'billing']. The first schema is the default. One key, and no list of tables.
  • make:model --all reads the tables of each schema. make:model <table> and make:scaffold <table> look for the table in the schemas; <schema>.<table> names one, for example crest make:model billing.invoices.
  • A table name in two schemas (for example public.users and audit.users): crest stops and asks for a class in models.classes, with the key <schema>.<table>, for example 'audit.users' => 'AuditUser'.
  • make:model, make:model --all and make:scaffold read the columns and the keys of each schema. hasMany() reads the keys of each schema.
  • A relation for a foreign key to a table in another schema, in place of the Skipped line.
  • config:show shows the schemas.
  • Docs.

Depends on

Prepared by #69

ModelNames::schemaOf(), the strict schema key (an array stops crest today), the RelationAlias keys with no schema, and ForeignKeys::elsewhere().

Done when

  • In a PostgreSQL database with tables in two schemas, crest make:model --all writes a model for each table, each with its setSchema().
  • A foreign key from one schema to the other gives a relation.
  • A table name in two schemas stops crest until models.classes has a class for it.

From #69.

Activity

  1. self-assigned this
    on Nov 21, 2026
  2. added
    enhancement
    on Nov 21, 2026
  3. added theissue type on Nov 21, 2026
  4. moved this from Backlog to Active Sprint in Phalcon v5on Nov 27, 2026
  5. added 2 commits that reference this issue on Nov 28, 2026
  6. niden commented on Nov 28, 2026

    @niden
    SponsorMemberAuthor

    Resolved in #112

  7. moved this from Active Sprint to Implemented in Phalcon v5on Nov 28, 2026
  8. added a commit that references this issue on Nov 28, 2026
  9. moved this from Implemented to Released in Phalcon v5on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions