Elixir Phoenix提示运行不存在的迁移

Elixir Phoenix提示运行不存在的迁移,elixir,phoenix-framework,ecto,Elixir,Phoenix Framework,Ecto,让我们描述一下问题: 我用mix phx.new创建了一个新的phoenix应用程序 我在{dev,test}中配置了一个数据库连接 我使用mix phx.gen.context创建了一个上下文,它创建了一个迁移 我第一次尝试运行服务器,但它告诉我我已取消部署迁移 there are pending migrations for repo: Some.Repo. Try running `mix ecto.migrate` in the command line to migrate it

让我们描述一下问题:

我用mix phx.new创建了一个新的phoenix应用程序 我在{dev,test}中配置了一个数据库连接 我使用mix phx.gen.context创建了一个上下文,它创建了一个迁移 我第一次尝试运行服务器,但它告诉我我已取消部署迁移

there are pending migrations for repo: Some.Repo. 
Try running `mix ecto.migrate` in the command line to migrate it
然后我意识到我不需要它们,因为我已经有了数据库,所以我删除了迁移文件/priv/repo/migrations/*并重试

现在mixexto.migrations没有显示任何内容,但它没有删除服务器提示。然后我发现ecto在数据库中为迁移创建了一个额外的表,所以我检查了它,它是空的

我丢弃了它并尝试再次运行服务器,但显示了相同的消息

为了确保这不是一个EXTO问题,我已经准备好了测试,它们运行得很好,唯一的问题是运行服务器时显示的迁移提示

我还没有任何端点,因为我计划在验证模型是否正常工作后使用GraphQL,但这条消息令人困惑

迁移是否有任何隐藏文件,或者我是否遗漏了其他内容

堆栈跟踪:

[error] #PID<0.451.0> running Some.Endpoint (connection #PID<0.449.0>, stream id 1) terminated
Server: localhost:4000 (http)
Request: GET /
** (exit) an exception was raised:
    ** (Phoenix.Ecto.PendingMigrationError) there are pending migrations for repo: Some.Repo. Try running `mix ecto.migrate` in the command line to migrate it
        (phoenix_ecto 4.2.1) lib/phoenix_ecto/check_repo_status.ex:67: Phoenix.Ecto.CheckRepoStatus.check_pending_migrations!/2
        (phoenix_ecto 4.2.1) lib/phoenix_ecto/check_repo_status.ex:27: anonymous fn/3 in Phoenix.Ecto.CheckRepoStatus.call/2
        ...
[error] #PID<0.454.0> running Some.Endpoint (connection #PID<0.449.0>, stream id 2) terminated
Server: localhost:4000 (http)
Request: GET /favicon.ico
** (exit) an exception was raised:
    ** (Phoenix.Ecto.PendingMigrationError) there are pending migrations for repo: Some.Repo. Try running `mix ecto.migrate` in the command line to migrate it
        (phoenix_ecto 4.2.1) lib/phoenix_ecto/check_repo_status.ex:67: Phoenix.Ecto.CheckRepoStatus.check_pending_migrations!/2
        (phoenix_ecto 4.2.1) lib/phoenix_ecto/check_repo_status.ex:27: anonymous fn/3 in Phoenix.Ecto.CheckRepoStatus.call/2
        ...
使现代化 经过进一步调查,项目似乎以某种方式存储了由mix phx.new.context生成的第一次迁移


每当我重新创建数据库时,它都会提示迁移这个上下文。我的项目中没有提到迁移的任何文件。

我遇到了这个问题,只有通过删除_build文件夹才能解决,其他方法都不起作用,而不是exto.reset或删除migrations表。Elixir必须在项目的某个地方存储与迁移相关的某些状态

rm -rf _build/

我遇到了这个问题,只有通过删除_build文件夹才能解决,其他方法都不起作用,没有执行exto.reset,也没有删除migrations表。Elixir必须在项目的某个地方存储与迁移相关的某些状态

rm -rf _build/

运行mix-exto.migrations这将显示您的迁移。此列表有望与/priv/repo/migrations中的列表匹配。 转到_build//priv/repo/migrations并从此处删除不在其他两个迁移列表中的文件。
它似乎对我有用

运行mix-exto.migrations这将向您展示您的迁移。此列表有望与/priv/repo/migrations中的列表匹配。 转到_build//priv/repo/migrations并从此处删除不在其他两个迁移列表中的文件。
它似乎对我很有用

Ecto.Migrator.migrationsSome.Repo为你带来了什么回报?@KonstantinStrukov[{:down,202011111101131,create_person}],因为我担心这个问题不允许我测试api。你有没有尝试找到这个神秘的create_person迁移?看-在我看来,似乎每个repo都可以配置迁移路径,所以请检查Some.repo.config[:priv]为您提供了什么-您的迁移可能位于不同的位置…@KonstantinStrukov我通过删除表并运行提示的迁移来解决这个问题。后来我重新创建数据库时,它确实起了作用。我想,在其他情况下,这将是一个重大问题。现在Some.Repo.config[:priv]返回nil。Ecto.Migrator.migrationsSome.Repo为您返回了什么?@KonstantinStrukov[{:down,202011111101131,create_person}]因为我担心这个问题不允许我测试api。您是否尝试找到这个神秘的create_person迁移?看-在我看来,似乎每个repo都可以配置迁移路径,所以请检查Some.repo.config[:priv]为您提供了什么-您的迁移可能位于不同的位置…@KonstantinStrukov我通过删除表并运行提示的迁移来解决这个问题。后来我重新创建数据库时,它确实起了作用。我想,在其他情况下,这将是一个重大问题。现在,Some.Repo.config[:priv]返回nil。