-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ajout et amlelioration des methode de generation d id dans les schemas
- Loading branch information
Julien Houvion
committed
Jun 20, 2016
1 parent
0e5b9d0
commit 305071a
Showing
1 changed file
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,50 @@ | ||
<?php namespace FrenchFrogs\Laravel\Database\Schema; | ||
|
||
|
||
/** | ||
* Extension | ||
* | ||
* Class Blueprint | ||
* @package FrenchFrogs\Laravel\Database\Schema | ||
*/ | ||
class Blueprint extends \Illuminate\Database\Schema\Blueprint | ||
{ | ||
|
||
/** | ||
* Ajoute une column de type binary UUID | ||
* | ||
* @param string $column | ||
* @return \Illuminate\Support\Fluent | ||
*/ | ||
public function binaryUuid($column = 'id', $primary = true) | ||
{ | ||
$column = $this->addColumn('binaryuuid', $column, ['length' => 16]); | ||
|
||
// gestion de la clé primaire | ||
if ($primary) { | ||
$column->primary(); | ||
} | ||
|
||
return $column; | ||
} | ||
|
||
public function binaryUuid($column) | ||
|
||
/** | ||
* Ajoute une colonne id de type string | ||
* | ||
* @param string $column | ||
* @param int $size | ||
* @return mixed | ||
*/ | ||
public function stringId($column = 'id', $size = 32, $primary = true) | ||
{ | ||
return $this->addColumn('binaryuuid', $column, ['length' => 16]); | ||
$column = $this->string($column, $size); | ||
|
||
// gestion de la clé primaire | ||
if ($primary) { | ||
$column->primary(); | ||
} | ||
|
||
return $column; | ||
} | ||
} |