The migrate sql still remaining after remove migrate php file

Viewed 39

The migrate sql still remaining after remove migrate php file.

After run migrate db I want to remove this file form source code because this logic is not necessary. But when I run this command to double check what will be execute. Any idea, please help.

 bin/console doctrine:schema:update --dump-sql

The migrate alter table still remaining:

ALTER TABLE categories ALTER status SET NOT NULL

Migration file php:

namespace Doctrine\Migrations;

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

/**
 * Auto-generated Migration: Please modify to your needs!
 */
final class Version20220601122421 extends AbstractMigration
{
    public function getDescription(): string
    {
        return '';
    }

    public function up(Schema $schema): void
    {
        $this->addSql('ALTER TABLE categories ALTER status SET NOT NULL');
    }

    public function down(Schema $schema): void
    {
        $this->addSql('ALTER TABLE categories ALTER status DROP NOT NULL');
    }
}

1 Answers

Check the mapping of your categories entity.

doctrine:schema:update compares what your database should look like (based on the mapping information of your entities) with how it actually looks, and executes the SQL statements needed to update the database schema to where it should be.

Related