Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug]model字段变更后,sync方法没有成功删除该字段 #396

Open
wmui opened this issue Jun 16, 2023 · 2 comments
Open

[bug]model字段变更后,sync方法没有成功删除该字段 #396

wmui opened this issue Jun 16, 2023 · 2 comments

Comments

@wmui
Copy link

wmui commented Jun 16, 2023

在SQLite中,修改model中的任意一个字段,sync方法无法成功删除旧的字段:

image

如图所示,在执行删除的过程中提示语法错误,但是该条语句复制到命令行是可以正确执行的:

image
@cyjake
Copy link
Owner

cyjake commented Jun 16, 2023

  leoric [query] [1.144] DROP TABLE IF EXISTS "role" +1ms
  leoric [query] [0.461] CREATE TABLE "role" ("authorities" VARCHAR(255), "name" VARCHAR(255), "created_at" DATETIME, "updated_at" DATETIME, "id" INTEGER PRIMARY KEY) +0ms
  leoric [query] [0.17] PRAGMA table_info("role") +1ms
  leoric [load] Role `role` out of sync ["authorities"] +5ms
  leoric [query] [0.622] ALTER TABLE "role" DROP COLUMN "authorities" +1ms
  leoric [query] [0.07] PRAGMA table_info("role") +0ms
  leoric [query] [0.121] PRAGMA table_info("role") +0ms

  ․

  1 passing (54ms)

有点奇怪,似乎无法复现你说的这个问题

@wmui
Copy link
Author

wmui commented Jun 16, 2023

这个是必现的,我稍晚些看看能不能提供一个demo出来,流程如下:

  1. 创建一张表,执行sync同步
  2. 修改表中的一个字段为其他名字
  3. 再次sync,就报错了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants