繁体   English   中英

教义迁移不尊重实体

[英]Doctrine migration is not respecting entity

我在symfony中建立了一个新实体

...
class MenuDay
{
    /**
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $name;

    /**
     * @ORM\ManyToOne(targetEntity="App\Entity\MenuWeek", inversedBy="menuDays")
     */
    private $menuWeek;
...

当我尝试make:migration时,它只生成没有列的表

...
public function up(Schema $schema) : void
{
    // this up() migration is auto-generated, please modify it to your needs
    $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'sqlite', 'Migration can only be executed safely on \'sqlite\'.');

    $this->addSql('CREATE TABLE menu_day (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL)');
}
...

它看起来像错误,但我不知道我在做什么错。 我也想避免手动将这些新列硬编码到迁移文件中。 这是我的第一个此类错误项目。 如果您需要其他信息,我将对此帖子进行编辑。

我有点慌乱。 请帮助我,您是我唯一的希望。 :) 谢谢!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM