-
-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
SQLite does not support addForeignKey() but supports foreign key constraints inside columns definitions of CREATE TABLE query.
https://www.sqlite.org/foreignkeys.html
CREATE TABLE track(
trackid INTEGER,
trackname TEXT,
trackartist INTEGER,
FOREIGN KEY(trackartist) REFERENCES artist(artistid)
);The follow command throws an Exception in SQLite
./yii migrate:create post --command=table --fields='department_id:integer:notNull:foreignKey(department)'Due to column foreign key is initialized separately
db-migration/resources/views/_createTable.php
Lines 14 to 26 in 940d988
| echo " \$b->createTable('$table', [\n"; | |
| foreach ($columns as $column) { | |
| if (!$column->hasDecorators()) { | |
| echo " '{$column->getProperty()}',\n"; | |
| } else { | |
| echo " '{$column->getProperty()}' => \$b->{$column->getDecoratorsString()},\n"; | |
| } | |
| } | |
| echo " ]);\n"; | |
| echo $this->render(__DIR__ . '/_addForeignKeys.php', [ | |
| 'table' => $table, | |
| 'foreignKeys' => $foreignKeys, | |
| ]); |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels