From a530301b617acb76674d11a1d0b23cf0469decf4 Mon Sep 17 00:00:00 2001 From: viktorprogger Date: Thu, 21 Dec 2023 23:22:25 +0600 Subject: [PATCH] Fix #227 --- src/AbstractMigrationBuilder.php | 64 ++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/src/AbstractMigrationBuilder.php b/src/AbstractMigrationBuilder.php index b5f760b8..28a15920 100644 --- a/src/AbstractMigrationBuilder.php +++ b/src/AbstractMigrationBuilder.php @@ -65,6 +65,56 @@ public function bigPrimaryKey(int $length = null): ColumnInterface return $this->schema->createColumn(SchemaInterface::TYPE_BIGPK, $length); } + /** + * Creates an unsigned big primary key column. + * + * @param int|null $length The column size or precision definition. + * + * This parameter will be ignored if not supported by the DBMS. + * + * @return ColumnInterface The column instance which can be further customized. + */ + public function bigPrimaryKeyUnsigned(int $length = null): ColumnInterface + { + return $this->schema->createColumn(SchemaInterface::TYPE_UBIGPK, $length); + } + + /** + * Creates a UUID primary key column. + * + * This parameter will be ignored if not supported by the DBMS. + * + * @return ColumnInterface The column instance which can be further customized. + */ + public function uuidPrimaryKey(): ColumnInterface + { + return $this->schema->createColumn(SchemaInterface::TYPE_UUID_PK); + } + + /** + * Creates a UUID primary key column with a sequence. + * + * This parameter will be ignored if not supported by the DBMS. + * + * @return ColumnInterface The column instance which can be further customized. + */ + public function uuidPrimaryKeySequenced(): ColumnInterface + { + return $this->schema->createColumn(SchemaInterface::TYPE_UUID_PK_SEQ); + } + + /** + * Creates a UUID column. + * + * This parameter will be ignored if not supported by the DBMS. + * + * @return ColumnInterface The column instance which can be further customized. + */ + public function uuid(): ColumnInterface + { + return $this->schema->createColumn(SchemaInterface::TYPE_UUID); + } + /** * Creates a binary column. * @@ -254,6 +304,20 @@ public function primaryKey(int $length = null): ColumnInterface return $this->schema->createColumn(SchemaInterface::TYPE_PK, $length); } + /** + * Creates an unsigned primary key column. + * + * @param int|null $length The column size or precision definition. + * + * This parameter will be ignored if not supported by the DBMS. + * + * @return ColumnInterface The column instance which can be further customized. + */ + public function primaryKeyUnsigned(int $length = null): ColumnInterface + { + return $this->schema->createColumn(SchemaInterface::TYPE_UPK, $length); + } + /** * Creates a smallint column. *