| @@ 749-765 (lines=17) @@ | ||
| 746 | return ['name' => 'varchar', 'limit' => $limit ?: 255]; |
|
| 747 | case static::PHINX_TYPE_CHAR: |
|
| 748 | return ['name' => 'char', 'limit' => $limit ?: 255]; |
|
| 749 | case static::PHINX_TYPE_TEXT: |
|
| 750 | if ($limit) { |
|
| 751 | $sizes = [ |
|
| 752 | // Order matters! Size must always be tested from longest to shortest! |
|
| 753 | 'longtext' => static::TEXT_LONG, |
|
| 754 | 'mediumtext' => static::TEXT_MEDIUM, |
|
| 755 | 'text' => static::TEXT_REGULAR, |
|
| 756 | 'tinytext' => static::TEXT_SMALL, |
|
| 757 | ]; |
|
| 758 | foreach ($sizes as $name => $length) { |
|
| 759 | if ($limit >= $length) { |
|
| 760 | return ['name' => $name]; |
|
| 761 | } |
|
| 762 | } |
|
| 763 | } |
|
| 764 | ||
| 765 | return ['name' => 'text']; |
|
| 766 | case static::PHINX_TYPE_BINARY: |
|
| 767 | return ['name' => 'binary', 'limit' => $limit ?: 255]; |
|
| 768 | case static::PHINX_TYPE_VARBINARY: |
|
| @@ 770-786 (lines=17) @@ | ||
| 767 | return ['name' => 'binary', 'limit' => $limit ?: 255]; |
|
| 768 | case static::PHINX_TYPE_VARBINARY: |
|
| 769 | return ['name' => 'varbinary', 'limit' => $limit ?: 255]; |
|
| 770 | case static::PHINX_TYPE_BLOB: |
|
| 771 | if ($limit) { |
|
| 772 | $sizes = [ |
|
| 773 | // Order matters! Size must always be tested from longest to shortest! |
|
| 774 | 'longblob' => static::BLOB_LONG, |
|
| 775 | 'mediumblob' => static::BLOB_MEDIUM, |
|
| 776 | 'blob' => static::BLOB_REGULAR, |
|
| 777 | 'tinyblob' => static::BLOB_SMALL, |
|
| 778 | ]; |
|
| 779 | foreach ($sizes as $name => $length) { |
|
| 780 | if ($limit >= $length) { |
|
| 781 | return ['name' => $name]; |
|
| 782 | } |
|
| 783 | } |
|
| 784 | } |
|
| 785 | ||
| 786 | return ['name' => 'blob']; |
|
| 787 | case static::PHINX_TYPE_BIT: |
|
| 788 | return ['name' => 'bit', 'limit' => $limit ?: 64]; |
|
| 789 | case static::PHINX_TYPE_INTEGER: |
|