Skip to content

Cannot run migrations on in-memory db #75

@LostKobrakai

Description

@LostKobrakai

I'm not really sure this is an issue with this library, but not using an in memory db works just fine.

Run using elixir script.exs

Mix.install([:ecto_sql, :ecto_sqlite3])

Application.put_env(:my_app, Repo, database: ":memory:", migration_lock: false)

defmodule Repo do
  use Ecto.Repo, otp_app: :my_app, adapter: Ecto.Adapters.SQLite3
end

:ok = Ecto.Adapters.SQLite3.storage_up(Repo.config())
Repo.start_link()

defmodule Migration do
  use Ecto.Migration

  def change do
    create table("abc", primary_key: false) do
      add(:id, :binary_id, null: false)
      add(:uuid, :binary_id, null: false)

      timestamps()
    end

    create table(:testing) do
      add :company, :string
      add :name, :string
      add :vintage, :string
      add :drunk_at, :utc_datetime

      timestamps()
    end

    create index(:testing, [:company])
  end
end

Ecto.Migrator.up(Repo, 0, Migration, log: :info, skip_table_creation: false)
** (Exqlite.Error) no such table: schema_migrations
SELECT CAST(s0."version" AS INTEGER) FROM "schema_migrations" AS s0
    (ecto_sql 3.8.3) lib/ecto/adapters/sql.ex:932: Ecto.Adapters.SQL.raise_sql_call_error/1
    (ecto_sql 3.8.3) lib/ecto/adapters/sql.ex:847: Ecto.Adapters.SQL.execute/6
    (ecto 3.8.4) lib/ecto/repo/queryable.ex:221: Ecto.Repo.Queryable.execute/4
    (ecto 3.8.4) lib/ecto/repo/queryable.ex:19: Ecto.Repo.Queryable.all/3
    (ecto_sql 3.8.3) lib/ecto/migrator.ex:536: Ecto.Migrator.lock_for_migrations/4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions