/**
  * Create next row migration as ColumnSchemaBuilder
  * @param array $config
  * @return ColumnSchemaBuilder
  */
 protected function buildNextField($config)
 {
     /** @var ColumnSchemaBuilder $row */
     $row = null;
     $length = isset($config['length']) && $config['length'] ? $config['length'] : null;
     $precision = isset($config['precision']) && $config['length'] ? $config['precision'] : null;
     $scale = isset($config['scale']) && $config['length'] ? $config['scale'] : null;
     $this->migrationClass = new Migration(['db' => $this->db]);
     if (!(isset($config['type']) && $config['type'])) {
         throw new \ErrorException("Type field is undefined");
     }
     switch ($config['type']) {
         case Schema::TYPE_PK:
             $row = $this->migrationClass->integer($length);
             break;
         case Schema::TYPE_UPK:
             $row = $this->migrationClass->integer($length);
             break;
         case Schema::TYPE_INTEGER:
             $row = $this->migrationClass->integer($length);
             break;
         case Schema::TYPE_BIGINT:
             $row = $this->migrationClass->bigInteger($length);
             break;
         case Schema::TYPE_BIGPK:
             $row = $this->migrationClass->bigInteger($length);
             break;
         case Schema::TYPE_UBIGPK:
             $row = $this->migrationClass->bigInteger($length);
             break;
         case Schema::TYPE_BINARY:
             $row = $this->migrationClass->binary($length);
             break;
         case Schema::TYPE_CHAR:
             $row = $this->migrationClass->char($length);
             break;
         case Schema::TYPE_TEXT:
             $row = $this->migrationClass->text();
             break;
         case Schema::TYPE_DATE:
             $row = $this->{$this}->migrationClass->date();
             break;
         case Schema::TYPE_DECIMAL:
             $row = $this->migrationClass->decimal($precision, $scale);
             break;
         case Schema::TYPE_DOUBLE:
             $row = $this->migrationClass->double($precision);
             break;
         case Schema::TYPE_FLOAT:
             $row = $this->migrationClass->float($precision);
             break;
         case Schema::TYPE_DATETIME:
             $row = $this->migrationClass->dateTime($precision);
             break;
         case Schema::TYPE_MONEY:
             $row = $this->migrationClass->money($precision, $scale);
             break;
         case Schema::TYPE_SMALLINT:
             $row = $this->migrationClass->smallInteger($length);
             break;
         case Schema::TYPE_TIME:
             $row = $this->migrationClass->time($precision);
             break;
         case Schema::TYPE_TIMESTAMP:
             $row = $this->migrationClass->timestamp($precision);
             break;
         default:
             $row = $this->migrationClass->string($length);
             break;
     }
     if (isset($config['type']) && ($config['type'] == Schema::TYPE_UPK || $config['type'] == Schema::TYPE_UBIGPK) || isset($config['unsigned']) && $config['unsigned']) {
         $row = $row->unsigned();
     }
     if (isset($config['default']) && !empty($config['default'])) {
         $row = $row->defaultValue($config['default']);
     }
     if (isset($config['is_not_null']) && $config['is_not_null']) {
         $row = $row->notNull();
     }
     if (isset($config['comment']) && $config['comment']) {
         $row = $row->comment($config['comment']);
     }
     if (isset($config['isCompositeKey']) && $config['isCompositeKey']) {
         $this->primaryKeys[] = $config['name'];
     }
     $config['related_table'] = isset($config['related_table']) ? trim($config['related_table']) : null;
     $config['related_field'] = isset($config['related_field']) ? trim($config['related_field']) : null;
     if ($config['related_table'] && $config['related_field']) {
         $this->relations[] = ['fk_name' => isset($config['fk_name']) && $config['fk_name'] ? $config['fk_name'] : self::getNameForeignKey($this->tableNameRaw, $config['related_table'], $config['name'], $config['related_field'], 255), 'table_name' => $this->addTablePrefix($this->tableNameRaw), 'field' => $config['name'], 'related_table' => $this->addTablePrefix($config['related_table']), 'related_field' => $config['related_field']];
     }
     return $row;
 }