我正在尝试使用aerich
withtortoise
来管理 sqlite 的迁移。当我aerich upgrade
之后aerich migrate --name some_migration
(这似乎成功创建了一个迁移文件)时,我收到了这个错误。
tortoise.exceptions.OperationalError: column <some column> of relation <some table> does not exist
我所做的更改只是删除要测试的列。
from tortoise.models import Model
from tortoise import fields
class User(Model):
id = fields.IntField(pk=True)
username = fields.CharField(50, unique=True, null=False)
# some_column = fields.CharField(50, null=False) # just delete this one to check if migration works
迁移文件如下所示。
-- upgrade --
ALTER TABLE "user" DROP COLUMN "some_column";
-- downgrade --
ALTER TABLE "user" ADD "some_column" VARCHAR(50) NOT NULL;
有人可以帮我吗?