Skip to content

Invalid column size during migration in Mysql Adapater #1264

@Zaszczyk

Description

@Zaszczyk

Expected and Actual Behavior

Actual behavior: I generate migration of MySQL table with column MEDIUMTEXT and get size=1 of this field
SQL DDL:

create table map
(
  id int unsigned auto_increment
    primary key,
  path mediumtext null,
  created_at datetime null
)
  charset=utf8;

Phalcon migration:

public function morph()
    {
        $this->morphTable('map', [
                'columns' => [
                    new Column(
                        'id',
                        [
                            'type' => Column::TYPE_INTEGER,
                            'unsigned' => true,
                            'notNull' => true,
                            'autoIncrement' => true,
                            'size' => 10,
                            'first' => true
                        ]
                    ),
               
                    new Column(
                        'path',
                        [
                            'type' => Column::TYPE_TEXT,
                            'size' => 1,
                            'after' => 'id'
                        ]
                    ),

                    new Column(
                        'created_at',
                        [
                            'type' => Column::TYPE_DATETIME,
                            'size' => 1,
                            'after' => 'path'
                        ]
                    )
                ],
                'indexes' => [
                    new Index('PRIMARY', ['id'], 'PRIMARY'),
                ],
                'options' => [
                    'TABLE_TYPE' => 'BASE TABLE',
                    'AUTO_INCREMENT' => '298483',
                    'ENGINE' => 'InnoDB',
                    'TABLE_COLLATION' => 'utf8_general_ci'
                ],
            ]
        );
    }

Expected behavior: Phalcon migration should ommit size with MEDIUMTEXT field. When I manually remove 'size' =>1 then migration works fine.

Details

Phalcon DevTools (3.4.0)

Environment:
OS: Linux 085ce900582b 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64
PHP Version: 7.2.14-1+ubuntu16.04.1+deb.sury.org+1
PHP SAPI: cli
PHP Bin: /usr/bin/php7.2
PHP Extension Dir: /usr/lib/php/20170718
PHP Bin Dir: /usr/bin
Loaded PHP config: /etc/php/7.2/cli/php.ini
Versions:
Phalcon DevTools Version: 3.4.0
Phalcon Version: 3.3.2
AdminLTE Version: 2.3.6

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions