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

ash_postgres.generate_migrations does not create schemas #247

Open
cschmatzler opened this issue Apr 25, 2024 · 1 comment
Open

ash_postgres.generate_migrations does not create schemas #247

cschmatzler opened this issue Apr 25, 2024 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@cschmatzler
Copy link

cschmatzler commented Apr 25, 2024

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 cschmatzler added bug Something isn't working needs review labels Apr 25, 2024
@zachdaniel
Copy link
Contributor

Yeah, I hadn't really considered it but it would make sense to add a create schema if not exists.

@zachdaniel zachdaniel added the good first issue Good for newcomers label Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants