From 289cf14ac92533779c8a4ddba813cb5ebf342dda Mon Sep 17 00:00:00 2001 From: auooru Date: Tue, 24 Dec 2019 18:33:32 +0800 Subject: [PATCH] add long integer --- src/Schema/ColumnDefinition.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Schema/ColumnDefinition.php b/src/Schema/ColumnDefinition.php index 1015e18..1e8d3c3 100644 --- a/src/Schema/ColumnDefinition.php +++ b/src/Schema/ColumnDefinition.php @@ -15,6 +15,8 @@ /** * 字段构造增强 * Class Blueprint + * @method ColumnDefinition unsignedBigInteger(string $name) static 相当于 Unsigned BIGINT + * @method ColumnDefinition bigInteger(string $name) static 相当于 BIGINT * @method ColumnDefinition integer(string $name) static 相当于 INTEGER * @method ColumnDefinition unsignedInteger(string $name) static 相当于 Unsigned INTEGER * @method ColumnDefinition tinyInteger(string $name) static 相当于 TINYINT @@ -53,12 +55,14 @@ class ColumnDefinition ]; const MAPPING = [ - 'integer' => [Adapter::PHINX_TYPE_INTEGER, 4294967295], // INT_REGULAR - 'smallInteger' => [Adapter::PHINX_TYPE_INTEGER, 65535], // INT_SMALL + 'bigInteger' => [Adapter::PHINX_TYPE_BIG_INTEGER, null], // INT_REGULAR + 'integer' => [Adapter::PHINX_TYPE_INTEGER, null], // INT_REGULAR + 'smallInteger' => [Adapter::PHINX_TYPE_SMALL_INTEGER, null], // INT_SMALL 'tinyInteger' => [Adapter::PHINX_TYPE_INTEGER, 255], // INT_TINY - 'unsignedInteger' => [Adapter::PHINX_TYPE_INTEGER, 4294967295], // INT_REGULAR - 'unsignedSmallInteger' => [Adapter::PHINX_TYPE_INTEGER, 65535], // INT_SMALL + 'unsignedBigInteger' => [Adapter::PHINX_TYPE_BIG_INTEGER, null], // INT_REGULAR + 'unsignedInteger' => [Adapter::PHINX_TYPE_INTEGER, null], // INT_REGULAR + 'unsignedSmallInteger' => [Adapter::PHINX_TYPE_SMALL_INTEGER, null], // INT_SMALL 'unsignedTinyInteger' => [Adapter::PHINX_TYPE_INTEGER, 255], // INT_TINY 'string' => [Adapter::PHINX_TYPE_STRING, 255], // TEXT_TINY @@ -119,11 +123,13 @@ public static function make($callName, $arguments) // 按需设置 switch ($callName) { + case 'bigInteger': case 'integer': case 'smallInteger': case 'tinyInteger': $column->setDefault(0); break; + case 'unsignedBigInteger': case 'unsignedInteger': case 'unsignedSmallInteger': case 'unsignedTinyInteger':