Skip to content

migration_diff for LONGTEXT create TEXT since v5.x #1029

@infoliv

Description

@infoliv

Since Migration 5.x, when I do the following steps :

  1. I create a table test using phpmyadmin with 3 fields :
  • id INT AUTOINCREMENT
  • title VARCHAR (255)
  • description LONGTEXT
  1. I create a migration file with bin/cake bake migration_diff CreateTest

This generates the following migration file CreateTest.php :

use Migrations\BaseMigration;

class CreateTest extends BaseMigration
{
    public bool $autoId = false;

    /**
     * Up Method.
     *
     * More information on this method is available here:
     * https://book.cakephp.org/migrations/5/en/migrations.html#the-up-method
     *
     * @return void
     */
    public function up(): void
    {
        $this->table('test')
            ->addColumn('id', 'integer', [
                'autoIncrement' => true,
                'default' => null,
                'limit' => null,
                'null' => false,
                'signed' => false,
            ])
            ->addPrimaryKey(['id'])
            ->addColumn('title', 'string', [
                'default' => null,
                'limit' => 255,
                'null' => false,
            ])
            ->addColumn('description', 'text', [
                'default' => null,
                'limit' => 4294967295,
                'null' => false,
            ])
            ->create();
    }

    /**
     * Down Method.
     *
     * More information on this method is available here:
     * https://book.cakephp.org/migrations/5/en/migrations.html#the-down-method
     *
     * @return void
     */
    public function down(): void
    {
        $this->table('test')->drop()->save();
    }
}

And then, when I try to migrate that migration file, the description field is no longer LONGTEXT but TEXT.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions