Repository navigation
Done
Labels
enhancementNew feature or request
Description
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.schematakes 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 --allreads the tables of each schema.make:model <table>andmake:scaffold <table>look for the table in the schemas;<schema>.<table>names one, for examplecrest make:model billing.invoices.- A table name in two schemas (for example
public.usersandaudit.users): crest stops and asks for a class inmodels.classes, with the key<schema>.<table>, for example'audit.users' => 'AuditUser'. make:model,make:model --allandmake:scaffoldread 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
Skippedline. config:showshows the schemas.- Docs.
Depends on
- [BUG]: PostgreSQL describeReferences() gives the database name as the referenced schema cphalcon#17816: on PostgreSQL,
getReferencedSchema()givescurrent_database(), not the schema of the key. The fix comes in cphalcon 5.24.0 andphalcon/phalcon6.0.0 ([NFR]: Release update for cphalcon 5.24.0 and phalcon/phalcon 6.0.0 #100). - A short design first: this issue is larger than the others.
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 --allwrites a model for each table, each with itssetSchema(). - A foreign key from one schema to the other gives a relation.
- A table name in two schemas stops crest until
models.classeshas a class for it.
From #69.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Type
Projects
- StatusShow more project fieldsReleased
Activity
[#86] - adding SQLite tests for a list of schemas, so that the covera…
Merge pull request #112 from phalcon/T86-make-model-schema-per-table
niden commentedon Nov 28, 2026
Resolved in #112
Merge pull request #114 from phalcon/T86-schema-list-minors