Error changing table via Doctrine Migrations

0

Through git I used the command below:

php bin/console doctrine:migrations:generate

I opened the file and made the change

<?php

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
class Version20160715170901 extends AbstractMigration
{
    /**
     * @param Schema $schema
     */
    public function up(Schema $schema)
    {
        // this up() migration is auto-generated, please modify it to your needs
        $interditado = $schema->getTable('interditado');
        $interditado_detalhe = $schema->getTable('interditado_detalhe');

        //Alterção do tipo da coluna de varchar para text para receber criptografia
        $interditado->getColumn('nome')->setType('text');
        $interditado->getColumn('cpf')->setType('text');
        $interditado->getColumn('nome_pai')->setType('text');
        $interditado->getColumn('nome_mae')->setType('text');

        $interditado_detalhe->getColumn('natureza')->setType('text');
        $interditado_detalhe->getColumn('livro')->setType('text');
        $interditado_detalhe->getColumn('folha')->setType('text');
        $interditado_detalhe->getColumn('termo')->setType('text');      
    }

    /**
     * @param Schema $schema
     */
    public function down(Schema $schema)
    {
        // this down() migration is auto-generated, please modify it to your needs

    }
}

I tried the code below and did not change the table

php bin/console doctrine:migrations:migrate --dry-run

Line 23

$interditado->getColumn('nome')->setType('text');
    
asked by anonymous 15.07.2016 / 17:59

1 answer

0

Solved. I removed the unique constraint from the flock and circled as below.

$type = \Doctrine\DBAL\Types\Type::getType('text');
        //Alterção do tipo da coluna de varchar para text para receber criptografia
        $interditado->getColumn('nome')->setType($type);
    
15.07.2016 / 21:27