Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Elixir 什么是;找不到#PID<;的迁移运行程序进程;0.94.0>&引用;是指对混合异位迁移的反应?_Elixir_Phoenix Framework_Ecto - Fatal编程技术网

Elixir 什么是;找不到#PID<;的迁移运行程序进程;0.94.0>&引用;是指对混合异位迁移的反应?

Elixir 什么是;找不到#PID<;的迁移运行程序进程;0.94.0>&引用;是指对混合异位迁移的反应?,elixir,phoenix-framework,ecto,Elixir,Phoenix Framework,Ecto,我正在阅读有关Phoenix contexts()的指南,在您运行的部分 mix-exto.gen.migration将作者id添加到页面 然后在迁移中添加一些内容。以下是完整的输出: $mix-exto.migrate **(RuntimeError)找不到#PID的迁移运行程序进程 (exto_sql 3.5.3)lib/exto/migration/runner.ex:100:exto.migration.runner.prefix/0 (exto_sql3.5.3)lib/exto/m

我正在阅读有关Phoenix contexts()的指南,在您运行的部分

mix-exto.gen.migration将作者id添加到页面
然后在迁移中添加一些内容。以下是完整的输出:

$mix-exto.migrate
**(RuntimeError)找不到#PID的迁移运行程序进程
(exto_sql 3.5.3)lib/exto/migration/runner.ex:100:exto.migration.runner.prefix/0
(exto_sql3.5.3)lib/exto/migration.ex:1261:exto.migration._前缀__/1
(exto_sql3.5.3)lib/exto/migration.ex:525:exto.migration.create/1
priv/repo/migrations/20210120060822将作者id添加到页面。exs:10:(模块)
(stdlib 3.13.2)erl_eval.erl:680::erl_eval.do_apply/6
(elixir 1.11.2)lib/code.ex:1172:code.compile_file/2
(exto_sql3.5.3)lib/exto/migrator.ex:626:exto.migrator.load_migration/1.
(elixir 1.11.2)lib/enum.ex:1399:enum。“-map/2-lists^map/1-0-”/2
(elixir 1.11.2)lib/enum.ex:1399:enum。“-map/2-lists^map/1-0-”/2
(exto_sql3.5.3)lib/exto/migrator.ex:430:exto.migrator.run/4
(exto_sql3.5.3)lib/exto/migrator.ex:145:exto.migrator.with_repo/3
以下是迁移:

defmodule Hello.Repo.Migrations.AddAuthorIdToPages do
  use Ecto.Migration

  def change do
    alter table(:pages) do
      add :author_id, references(:authors, on_delete: :delete_all), null: false
    end
  end

  create index(:pages, [:author_id])
end

这是因为我在
def change
块之外调用了
create index
。将其更改为以下格式:

defmodule Hello.Repo.Migrations.AddAuthorIdToPages do
  use Ecto.Migration

  def change do
    alter table(:pages) do
      add :author_id, references(:authors, on_delete: :delete_all), null: false
    end
    create index(:pages, [:author_id])
  end
end