删除迁移php文件后,迁移的SQL仍保留
删除迁移php文件后,迁移的SQL仍保留。
运行迁移数据库后,我想删除此文件表单源代码,因为此逻辑不是必需的。但是,当我运行此命令以仔细检查将要执行的内容时。任何想法,请帮助。
bin/console doctrine:schema:update --dump-sql
迁移的Alter表仍然剩下:
ALTER TABLE categories ALTER status SET NOT NULL
迁移文件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');
}
}
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');
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查类别实体的映射。
学说:架构:更新比较您的数据库的外观(基于您实体的映射信息)与实际外观的外观,并执行将数据库架构更新为应其位置所需的SQL语句。
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.