I'm working through the guide about Phoenix contexts (https://hexdocs.pm/phoenix/contexts.html#thinking-about-design), at the part where you run
mix ecto.gen.migration add_author_id_to_pages
and then add some things to the migration. Here is the full output:
$ mix ecto.migrate
** (RuntimeError) could not find migration runner process for #PID<0.94.0>
    (ecto_sql 3.5.3) lib/ecto/migration/runner.ex:100: Ecto.Migration.Runner.prefix/0
    (ecto_sql 3.5.3) lib/ecto/migration.ex:1261: Ecto.Migration.__prefix__/1
    (ecto_sql 3.5.3) lib/ecto/migration.ex:525: Ecto.Migration.create/1
    priv/repo/migrations/20210120060822_add_author_id_to_pages.exs:10: (module)
    (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
    (ecto_sql 3.5.3) lib/ecto/migrator.ex:626: Ecto.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
    (ecto_sql 3.5.3) lib/ecto/migrator.ex:430: Ecto.Migrator.run/4
    (ecto_sql 3.5.3) lib/ecto/migrator.ex:145: Ecto.Migrator.with_repo/3
Here is the migration:
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
                It was because I had the create index call outside of the def change block. Changing it to this worked:
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
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With