2

我在更改学说 2 迁移中的表时遇到了一些问题。以下代码总是抛出错误:Operation 'Doctrine\DBAL\Platforms\AbstractPlatform::getAlterTableSQL' is not supported by platform

这很奇怪,因为 sqlite 支持 alter table。

public function up(Schema $schema)
{
    $user = $schema->getTable('user');
    $user->addColumn('resellerId', 'integer', array(
        'length'        => '10',
        'notnull'       => true,
        'unsigned'      => true,
    ));
}
4

2 回答 2

4

尽管 ALTER TABLE 被 Sqlite “支持”,但与大多数其他数据库(http://www.sqlite.org/lang_altertable.html)相比,允许的操作集是最小的,因此为什么它被认为是 Doctrine 不支持的数据库。

于 2010-09-05T17:52:43.693 回答
0

在使用 ORM 时,我注意到 MySQL 和 SQLite 之间存在一些细微的差异。使用 Doctrine,我发现 SQLite 中的外键关系不像 MySQL 中那样维护。

这很痛苦,因为我在内存数据库中使用 SQLite 进行单元测试,因为我不能保证通过 SQLite 的持久性测试也通过 MySQL。

实际上,为了让内存数据库中的 SQLite 与 Doctrine 一起工作,我必须调整 Doctrine SQLite 驱动程序(代码位于http://thecodeabode.blogspot.com/2010/12/dropping-sqlite-in-memory-databases-in。 html ) 因为为删除数据库而生成的 sql 语法在内存 dbs 中失败。

于 2011-01-05T00:44:05.677 回答