@@ 886-902 (lines=17) @@ | ||
883 | return ['name' => 'varchar', 'limit' => $limit ?: 255]; |
|
884 | case static::PHINX_TYPE_CHAR: |
|
885 | return ['name' => 'char', 'limit' => $limit ?: 255]; |
|
886 | case static::PHINX_TYPE_TEXT: |
|
887 | if ($limit) { |
|
888 | $sizes = [ |
|
889 | // Order matters! Size must always be tested from longest to shortest! |
|
890 | 'longtext' => static::TEXT_LONG, |
|
891 | 'mediumtext' => static::TEXT_MEDIUM, |
|
892 | 'text' => static::TEXT_REGULAR, |
|
893 | 'tinytext' => static::TEXT_SMALL, |
|
894 | ]; |
|
895 | foreach ($sizes as $name => $length) { |
|
896 | if ($limit >= $length) { |
|
897 | return ['name' => $name]; |
|
898 | } |
|
899 | } |
|
900 | } |
|
901 | ||
902 | return ['name' => 'text']; |
|
903 | case static::PHINX_TYPE_BINARY: |
|
904 | return ['name' => 'binary', 'limit' => $limit ?: 255]; |
|
905 | case static::PHINX_TYPE_VARBINARY: |
|
@@ 907-923 (lines=17) @@ | ||
904 | return ['name' => 'binary', 'limit' => $limit ?: 255]; |
|
905 | case static::PHINX_TYPE_VARBINARY: |
|
906 | return ['name' => 'varbinary', 'limit' => $limit ?: 255]; |
|
907 | case static::PHINX_TYPE_BLOB: |
|
908 | if ($limit) { |
|
909 | $sizes = [ |
|
910 | // Order matters! Size must always be tested from longest to shortest! |
|
911 | 'longblob' => static::BLOB_LONG, |
|
912 | 'mediumblob' => static::BLOB_MEDIUM, |
|
913 | 'blob' => static::BLOB_REGULAR, |
|
914 | 'tinyblob' => static::BLOB_SMALL, |
|
915 | ]; |
|
916 | foreach ($sizes as $name => $length) { |
|
917 | if ($limit >= $length) { |
|
918 | return ['name' => $name]; |
|
919 | } |
|
920 | } |
|
921 | } |
|
922 | ||
923 | return ['name' => 'blob']; |
|
924 | case static::PHINX_TYPE_BIT: |
|
925 | return ['name' => 'bit', 'limit' => $limit ?: 64]; |
|
926 | case static::PHINX_TYPE_SMALL_INTEGER: |