db-migration icon indicating copy to clipboard operation
db-migration copied to clipboard

[Enh] add tableOptions in Migration

Open pana1990 opened this issue 7 years ago • 7 comments

Yii use the following code in multiple places :

public function up()
    {
        $tableOptions = null;
        if ($this->db->driverName === 'mysql') {
            // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
        }
        $this->createTable('{{%whatever}}', [
            
        ], $tableOptions);
    }

https://github.com/yiisoft/yii2/blob/master/framework/rbac/migrations/m140506_102106_rbac_init.php#L56

https://github.com/yiisoft/yii2/blob/master/framework/web/migrations/m160313_153426_session_init.php#L26

https://github.com/yiisoft/yii2/blob/master/framework/caching/migrations/m150909_153426_cache_init.php#L44

some extensions as well

https://github.com/dektrium/yii2-user/blob/master/migrations/Migration.php#L39

you like we include this option to global custom tableOptions in configuration file?

what do you think about it?

pana1990 avatar Aug 04 '17 09:08 pana1990