mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-11-04 14:46:19 +08:00 
			
		
		
		
	Fix #11945: Fix Schema Builder MySQL column definition order
This commit is contained in:
		@ -4,6 +4,7 @@ Yii Framework 2 Change Log
 | 
			
		||||
2.0.33 under development
 | 
			
		||||
------------------------
 | 
			
		||||
 | 
			
		||||
- Bug #11945: Fix Schema Builder MySQL column definition order (simialbi)
 | 
			
		||||
- Bug #16334: Serializer support `\JsonSerializable` (germanow)
 | 
			
		||||
- Bug #17798: Avoid creating folder for stream log targets in `FileTarget` (wapmorgan)
 | 
			
		||||
- Bug #17850: Update to `ReplaceArrayValue` config exception message (alex-code)
 | 
			
		||||
 | 
			
		||||
@ -61,10 +61,10 @@ class ColumnSchemaBuilder extends AbstractColumnSchemaBuilder
 | 
			
		||||
                $format = '{type}{length}{comment}{check}{append}{pos}';
 | 
			
		||||
                break;
 | 
			
		||||
            case self::CATEGORY_NUMERIC:
 | 
			
		||||
                $format = '{type}{length}{unsigned}{notnull}{unique}{default}{comment}{check}{append}{pos}';
 | 
			
		||||
                $format = '{type}{length}{unsigned}{notnull}{default}{unique}{comment}{append}{pos}{check}';
 | 
			
		||||
                break;
 | 
			
		||||
            default:
 | 
			
		||||
                $format = '{type}{length}{notnull}{unique}{default}{comment}{check}{append}{pos}';
 | 
			
		||||
                $format = '{type}{length}{notnull}{default}{unique}{comment}{append}{pos}{check}';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->buildCompleteString($format);
 | 
			
		||||
 | 
			
		||||
@ -8,7 +8,7 @@
 | 
			
		||||
namespace yiiunit\framework\db\mysql;
 | 
			
		||||
 | 
			
		||||
use yii\db\mysql\ColumnSchemaBuilder;
 | 
			
		||||
use yii\db\Schema;
 | 
			
		||||
use yii\db\mysql\Schema;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ColumnSchemaBuilderTest tests ColumnSchemaBuilder for MySQL.
 | 
			
		||||
@ -44,6 +44,12 @@ class ColumnSchemaBuilderTest extends \yiiunit\framework\db\ColumnSchemaBuilderT
 | 
			
		||||
            ['integer(10) COMMENT \'test\'', Schema::TYPE_INTEGER, 10, [
 | 
			
		||||
                ['comment', 'test'],
 | 
			
		||||
            ]],
 | 
			
		||||
            // https://github.com/yiisoft/yii2/issues/11945 # TODO: real test against database
 | 
			
		||||
            ['string(50) NOT NULL COMMENT \'Property name\' COLLATE ascii_general_ci', Schema::TYPE_STRING, 50, [
 | 
			
		||||
                ['comment', 'Property name'],
 | 
			
		||||
                ['append', 'COLLATE ascii_general_ci'],
 | 
			
		||||
                ['notNull']
 | 
			
		||||
            ]],
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user