Skip to content

Create foreign key constraints with the correct type - #1397

Merged
asika32764 merged 2 commits into
masterfrom
copilot/fix-addforeignkey-constraint
Nov 8, 2026
Merged

asika32764 merged 2 commits into
masterfrom
copilot/fix-addforeignkey-constraint

Conversation

Copilot AI commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Schema::addForeignKey() created a primary-key constraint instead of a foreign-key constraint, so downstream schema handling misidentified it.

  • Schema: Use Constraint::TYPE_FOREIGN_KEY when creating the constraint.
  • Regression test: Verify the constraint is foreign and not primary.
$constraint = $schema->addForeignKey('category_id', 'categories', 'id');

$constraint->isForeignKey(); // true

Copilot AI linked an issue Nov 8, 2026 that may be closed by this pull request
Co-authored-by: asika32764 <1639206+asika32764@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Schema::addForeignKey() to create foreign key constraint Create foreign key constraints with the correct type Nov 8, 2026
Copilot AI requested a review from asika32764 November 8, 2026 04:48
@asika32764
asika32764 marked this pull request as ready for review November 8, 2026 05:36
@asika32764
asika32764 merged commit a812175 into master Nov 8, 2026
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.

[DB] Schema::addForeignKey()

2 participants