Skip to content

[NFR]: make:model: SQLite foreign keys #87

Description

@niden

make:model writes the relations from the foreign keys that Phalcon describeReferences() gives. On SQLite, two kinds of key do not give a correct relation:

  • A composite key: SQLite gives one reference for each column of the key. Each column gives its own relation, and each relation uses only part of the key. The docs say that crest does not support SQLite composite keys.
  • A key with no referenced columns: SQLite accepts REFERENCES customers with no column. crest skips the relation with the reason the key does not name the referenced columns.

Scope

  • On SQLite, a composite key gives one relation with all its columns.
  • On SQLite, a key with no referenced columns gives a relation to the primary key of the referenced table.
  • Database tests. On cphalcon before 5.24.0, they skip, as skipCompositeKeyOnOldCphalcon() does.
  • Docs: the two SQLite limits name the versions (before cphalcon 5.24.0 and before phalcon/phalcon 6.0.0).

Depends on (decided by the owner, 2026-11-27: the fix is in Phalcon)

Both come in cphalcon 5.24.0 and phalcon/phalcon 6.0.0 (#100).

Done when

  • On SQLite, a table with a composite foreign key gets one relation with all the columns of the key.
  • On SQLite, REFERENCES customers with no column gives a relation to the primary key of customers.

From #51.

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 4 commits that reference this issue on Nov 27, 2026
  6. niden commented on Nov 27, 2026

    @niden
    SponsorMemberAuthor

    Resolved in #106

  7. moved this from Active Sprint to Implemented in Phalcon v5on Nov 27, 2026
  8. 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