ash_postgres icon indicating copy to clipboard operation
ash_postgres copied to clipboard

`ash_postgres.generate_migrations` does not create schemas

Open cschmatzler opened this issue 1 year ago • 1 comments
trafficstars

Describe the bug When auto-generating migrations, prefixes are not taken into account.

To Reproduce

1. Create this module:
defmodule Leuchtturm.Auth.Identity do
  @moduledoc false
  use Ash.Resource,
    domain: Leuchtturm.Auth,
    data_layer: AshPostgres.DataLayer

  postgres do
    repo Leuchtturm.Repo
    schema "auth"
    table "identity"
  end

  attributes do
    integer_primary_key :id
    attribute :email, :ci_string, allow_nil?: false, public?: true
  end
end

2: Run mix ash_postgres.generate_migrations 3. Check to see that the migration does not have a create schema if not exists auth.

Expected behavior I would expect the schema to be created if it doesn't exist, because with the current behavior, dropping and recreating a database will fail with schema does not exist.

** Runtime

  • Elixir version 1.16.2
  • Erlang version 26.2.4
  • OS macOS Sonoma 14.4
  • Ash version 3.0.0-rc
  • any related extension versions ash_postgres 2.0.0-rc

Additional context Add any other context about the problem here.

cschmatzler avatar Apr 25 '24 12:04 cschmatzler