From 75ac9083761923548e7cb0de36cbdee813fb5b71 Mon Sep 17 00:00:00 2001 From: Maxim Smakouz Date: Wed, 15 Feb 2023 10:09:58 +0200 Subject: [PATCH 1/3] Add column types to the ExpectedValues --- src/Annotation/Column.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Annotation/Column.php b/src/Annotation/Column.php index 02919534..2bddb7a5 100644 --- a/src/Annotation/Column.php +++ b/src/Annotation/Column.php @@ -24,6 +24,12 @@ final class Column /** * @param non-empty-string $type Column type. {@see \Cycle\Database\Schema\AbstractColumn::$mapping} + * Column types `smallPrimary`, `timetz`, `timestamptz`, `interval`, `bitVarying`, `int4range`, `int8range`, + * `numrange`, `tsrange`, `tstzrange`, `daterange`, `jsonb`, `point`, `line`, `lseg`, `box`, `path`, + * `polygon`, `circle`, `cidr`, `inet`, `macaddr`, `macaddr8`, `tsvector`, `tsquery` are related + * to the PostgreSQL only {@see \Cycle\Database\Driver\Postgres\Schema\PostgresColumn::$mapping} + * Column type `datetime2` is related to the SQL Server only + * {@see \Cycle\Database\Driver\SQLServer\Schema\SQLServerColumn::$mapping} * @param non-empty-string|null $name Column name. Defaults to the property name. * @param non-empty-string|null $property Property that belongs to column. For virtual columns. * @param bool $primary Explicitly set column as a primary key. @@ -37,10 +43,12 @@ final class Column * @param bool $castDefault */ public function __construct( - #[ExpectedValues(values: ['primary', 'bigPrimary', 'enum', 'boolean', - 'integer', 'tinyInteger', 'smallInteger', 'bigInteger', - 'string', 'text', 'tinyText', 'longText', 'double', 'float', 'decimal', 'datetime', 'date', 'time', - 'timestamp', 'binary', 'tinyBinary', 'longBinary', 'json', 'uuid', + #[ExpectedValues(values: ['primary', 'smallPrimary', 'bigPrimary', 'enum', 'boolean', + 'integer', 'tinyInteger', 'smallInteger', 'bigInteger', 'string', 'text', 'tinyText', 'longText', 'double', + 'float', 'decimal', 'datetime', 'datetime2', 'date', 'time', 'timestamp', 'binary', 'tinyBinary', + 'longBinary', 'json', 'jsonb', 'uuid', 'timestamptz', 'timetz', 'bitVarying', 'bit', 'int4range', + 'int8range', 'numrange', 'tsrange', 'tstzrange', 'daterange', 'point', 'line', 'lseg', 'box', 'path', + 'polygon', 'circle', 'cidr', 'inet', 'macaddr', 'macaddr8', 'tsvector', 'tsquery', 'interval' ])] private string $type, private ?string $name = null, From f96f7da61471dcc23238e700ee3129d014b62a77 Mon Sep 17 00:00:00 2001 From: Maxim Smakouz Date: Wed, 15 Feb 2023 10:12:00 +0200 Subject: [PATCH 2/3] Fix CS --- src/Annotation/Column.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Annotation/Column.php b/src/Annotation/Column.php index 2bddb7a5..0de89d96 100644 --- a/src/Annotation/Column.php +++ b/src/Annotation/Column.php @@ -48,7 +48,7 @@ public function __construct( 'float', 'decimal', 'datetime', 'datetime2', 'date', 'time', 'timestamp', 'binary', 'tinyBinary', 'longBinary', 'json', 'jsonb', 'uuid', 'timestamptz', 'timetz', 'bitVarying', 'bit', 'int4range', 'int8range', 'numrange', 'tsrange', 'tstzrange', 'daterange', 'point', 'line', 'lseg', 'box', 'path', - 'polygon', 'circle', 'cidr', 'inet', 'macaddr', 'macaddr8', 'tsvector', 'tsquery', 'interval' + 'polygon', 'circle', 'cidr', 'inet', 'macaddr', 'macaddr8', 'tsvector', 'tsquery', 'interval', ])] private string $type, private ?string $name = null, From 2129c5858375f68566cefa8f6f268abf5efa48b5 Mon Sep 17 00:00:00 2001 From: Maxim Smakouz Date: Wed, 15 Feb 2023 10:48:51 +0200 Subject: [PATCH 3/3] Add comment --- src/Annotation/Column.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Annotation/Column.php b/src/Annotation/Column.php index 0de89d96..1e4f272a 100644 --- a/src/Annotation/Column.php +++ b/src/Annotation/Column.php @@ -43,12 +43,16 @@ final class Column * @param bool $castDefault */ public function __construct( - #[ExpectedValues(values: ['primary', 'smallPrimary', 'bigPrimary', 'enum', 'boolean', + #[ExpectedValues(values: ['primary', 'bigPrimary', 'enum', 'boolean', 'integer', 'tinyInteger', 'smallInteger', 'bigInteger', 'string', 'text', 'tinyText', 'longText', 'double', - 'float', 'decimal', 'datetime', 'datetime2', 'date', 'time', 'timestamp', 'binary', 'tinyBinary', - 'longBinary', 'json', 'jsonb', 'uuid', 'timestamptz', 'timetz', 'bitVarying', 'bit', 'int4range', - 'int8range', 'numrange', 'tsrange', 'tstzrange', 'daterange', 'point', 'line', 'lseg', 'box', 'path', - 'polygon', 'circle', 'cidr', 'inet', 'macaddr', 'macaddr8', 'tsvector', 'tsquery', 'interval', + 'float', 'decimal', 'datetime', 'date', 'time', 'timestamp', 'binary', 'tinyBinary', 'longBinary', 'json', + 'uuid', 'bit', + // PostgreSQL + 'smallPrimary', 'timetz', 'timestamptz', 'interval', 'bitVarying', 'int4range', 'int8range', 'numrange', + 'tsrange', 'tstzrange', 'daterange', 'jsonb', 'point', 'line', 'lseg', 'box', 'path', 'polygon', 'circle', + 'cidr', 'inet', 'macaddr', 'macaddr8', 'tsvector', 'tsquery', + // SQL Server + 'datetime2', ])] private string $type, private ?string $name = null,