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

[error] Could not retrieve migrated versions. #50

Open
rschooley opened this issue Nov 14, 2017 · 6 comments
Open

[error] Could not retrieve migrated versions. #50

rschooley opened this issue Nov 14, 2017 · 6 comments

Comments

@rschooley
Copy link

First, thanks for this driver/lib, it's great to get mensia with ecto.

For this issue, sometimes I run my test suite and I get this error. If I just keep rerunning my test suite it will eventually run without the error, not sure what the problem is.

[error] Could not retrieve migrated versions. This error usually happens due to the following:

  * The database does not exist
  * The "schema_migrations" table, which Ecto uses for managing
    migrations, was defined by another library

To fix the first issue, run "mix ecto.create".

To address the second, you can run "mix ecto.drop" followed by
"mix ecto.create". Alternatively you may configure Ecto to use
another table for managing migrations:

    config :foo, Foo.Repo,
      migration_source: "some_other_table_for_schema_migrations"

The full error report is shown below.

** (RuntimeError) Schema :schema_migrations does not exist
    lib/ecto_mnesia/table.ex:165: EctoMnesia.Table.transaction/2
    lib/ecto_mnesia/planner.ex:62: EctoMnesia.Planner.execute/6
    (ecto) lib/ecto/repo/queryable.ex:130: Ecto.Repo.Queryable.execute/5
    (ecto) lib/ecto/repo/queryable.ex:35: Ecto.Repo.Queryable.all/4
    (ecto) lib/ecto/migrator.ex:284: Ecto.Migrator.verbose_schema_migration/3
    (ecto) lib/ecto/migrator.ex:155: Ecto.Migrator.run/4
    (ecto) lib/mix/tasks/ecto.migrate.ex:84: anonymous fn/4 in Mix.Tasks.Ecto.Migrate.run/2
    (elixir) lib/enum.ex:675: Enum."-each/2-lists^foreach/1-0-"/2
@AndrewDryga
Copy link
Member

Do you use default mnesia_dir or an overriden one?

@rschooley
Copy link
Author

An overridden one to /usr/local/var/

@rschooley
Copy link
Author

Any chance of getting a fix for this. The driver is pretty much unusable with this issue.

@rschooley
Copy link
Author

I switched to using the default dir and still get this issue. If I rerun mix test enough times it will eventually work.

Is it some race condition when trying to load the database from disk?

@AndrewDryga
Copy link
Member

@rschooley I plan to work on adapter compatibility with upcoming Ecto 3.0 and will try to address this issue there.

It's hard to tell what exactly is happening, if you can provide a repo that reproduces this issue, I'd be more than happy to investigate it deeper.

@rschooley
Copy link
Author

Cool, thanks for the reply.

As a temporary fix I removed the create and migrate from the test aliases in mix.exs

"test": ["ecto.create --quiet", "ecto.migrate", "test"]

is now

"test": ["test"]

in my project and I can continue.

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