yiisoft / yiisoft/db

New method `ColumnDefinitionBuilderInterface::buildForeignKey()`

Open
#1,154 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

severity:BC breaking type:feature
Dominant language
PHP
Stars
216
Forks
51
Avg merge
3d 10h
Merged PRs (30d)
2

Description

Proposed new feature or change

Add new method

ColumnDefinitionBuilderInterface::buildForeignKey(ForeignKey $fk): string

to build foreign key definitions to create tables, like

CONSTRAINT {{{$fkName}}} FOREIGN KEY ([[id]]) REFERENCES {{{$referenceTableName}}}` ([[id]]) ON DELETE CASCADE ON UPDATE RESTRICT

Related with https://github.com/yiisoft/translator-message-db/blob/7060706db0a481d3f80c3a120e28ac812ff41dbc/src/DbSchemaManager.php#L129-L141

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ColumnDefinitionBuilderInterface and the related src/DbSchemaManager.php code at lines 129-141. Trace the existing table-definition builders and their tests to determine where foreign-key definitions are assembled. Done means the interface method builds the specified constraint, reference, and delete/update actions for table creation.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, sql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.