Skip to content

Commit

Permalink
Add applyPrimaryKeyType so that we can apply primary key type on a fo…
Browse files Browse the repository at this point in the history
…reign key column
  • Loading branch information
c9s committed Jun 18, 2016
1 parent 1886a8a commit 5e376da
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Schema/DeclareSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,24 @@ protected function insertAutoIdColumn($name = 'id', $columnType = 'integer')
$column = new AutoIncrementPrimaryKeyColumn($name, $columnType);
$this->primaryKey = $column->name;
$this->insertColumn($column);
return $column;
}

/**
* Apply primary key type on a column object.
*
* @return DeclareColumn
*/
protected function applyPrimaryKeyType(DeclareColumn $column)
{
$pkColumn = $this->columns[$this->primaryKey];
$column->type = $pkColumn->type;
$column->notNull = $pkColumn->notNull;
$column->unsigned = $pkColumn->unsigned;
return $column;
}


/**
* Find primary keys from columns.
*
Expand Down

0 comments on commit 5e376da

Please sign in to comment.