Skip to content

Commit 24aa4e0

Browse files
Merge pull request #25 from kirkbushell/feature/guid-uuid-support
Adds support for guid/uuid table column migrations
2 parents 463b1e4 + 3017b9a commit 24aa4e0

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/Schema/Table.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ public function __construct(Blueprint $table, Closure $callback = null)
2626
}
2727
}
2828

29+
/**
30+
* Create a new guid column on the table.
31+
*
32+
* @param string $column
33+
* @param int $length
34+
*
35+
* @return \Doctrine\DBAL\Schema\Column
36+
*/
37+
public function guid($column)
38+
{
39+
return $this->table->addColumn($column, Type::GUID);
40+
}
41+
2942
/**
3043
* Specify the primary key(s) for the table.
3144
*

tests/Schema/SchemaTableTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ protected function setUp()
2222
$this->table = new Table($this->dbal);
2323
}
2424

25+
public function test_guid()
26+
{
27+
$this->dbal->shouldReceive('addColumn')->with('guid', 'guid');
28+
29+
$this->table->guid('guid');
30+
}
31+
2532
public function test_primary()
2633
{
2734
$this->dbal->shouldReceive('setPrimaryKey')->with(['id'], null);

0 commit comments

Comments
 (0)