source/Spiral/Database/Drivers/Postgres/Schemas/PostgresColumn.php 1 location
|
@@ 187-197 (lines=11) @@
|
| 184 |
|
/** |
| 185 |
|
* {@inheritdoc} |
| 186 |
|
*/ |
| 187 |
|
public function enum($values): AbstractColumn |
| 188 |
|
{ |
| 189 |
|
$this->enumValues = array_map('strval', is_array($values) ? $values : func_get_args()); |
| 190 |
|
|
| 191 |
|
$this->type = 'character'; |
| 192 |
|
foreach ($this->enumValues as $value) { |
| 193 |
|
$this->size = max((int)$this->size, strlen($value)); |
| 194 |
|
} |
| 195 |
|
|
| 196 |
|
return $this; |
| 197 |
|
} |
| 198 |
|
|
| 199 |
|
/** |
| 200 |
|
* {@inheritdoc} |
source/Spiral/Database/Drivers/SQLServer/Schemas/SQLServerColumn.php 1 location
|
@@ 175-186 (lines=12) @@
|
| 172 |
|
/** |
| 173 |
|
* {@inheritdoc} |
| 174 |
|
*/ |
| 175 |
|
public function enum($values): AbstractColumn |
| 176 |
|
{ |
| 177 |
|
$this->enumValues = array_map('strval', is_array($values) ? $values : func_get_args()); |
| 178 |
|
sort($this->enumValues); |
| 179 |
|
|
| 180 |
|
$this->type = 'varchar'; |
| 181 |
|
foreach ($this->enumValues as $value) { |
| 182 |
|
$this->size = max((int)$this->size, strlen($value)); |
| 183 |
|
} |
| 184 |
|
|
| 185 |
|
return $this; |
| 186 |
|
} |
| 187 |
|
|
| 188 |
|
/** |
| 189 |
|
* {@inheritdoc} |