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 when generating Ecto migration with Gleam compiler added #40

Open
digzom opened this issue Mar 19, 2024 · 0 comments
Open

Error when generating Ecto migration with Gleam compiler added #40

digzom opened this issue Mar 19, 2024 · 0 comments

Comments

@digzom
Copy link

digzom commented Mar 19, 2024

Hey there,

I'm encountering an issue when trying to generate an ecto migration.

When I add the Gleam compiler to the compilers list in mix.exs file and try to run mix ecto.gen.migration <migration_name>, I receive this error:

** (Mix) Unknown dependency <migration_name> for environment <my_mix_env_value>

Steps to Reproduce:

  1. In a Mix project that uses Ecto, add the :gleam compiler to the compilers list in the mix.exs file.
  2. Attempt to run mix ecto.gen.migration.

Expected Behavior:
The migration should be generated normally without any errors.

Environment:

  • Library Version: mix_gleam 0.6.2
  • Operating System: Linux Ubuntu 22.04
  • Gleam 1.0.0
  • Elixir 1.16.1
  • Erlang 26.1

Mix file

defmodule PayCosern.MixProject do
  use Mix.Project

  @app_name :pay_cosern

  def project do
    [
      app: :pay_cosern,
      version: "0.1.0",
      elixir: "~> 1.16.1",
      name: "#{@app_name}",
      archives: [mix_gleam: "~> 0.6.2"],
      compilers: [:gleam] ++ Mix.compilers(),
      releases: [
        pay_cosern: [
          applications: [ex_unit: :permanent]
        ]
      ],
      erlc_paths: [
        "build/dev/erlang/#{@app_name}/_gleam_artefacts"
      ],
      erlc_include_path: "build/dev/erlang/#{@app_name}/include",
      prune_code_paths: false,
      deps: deps(),
      aliases: aliases()
    ]
  end

  defp aliases() do
    [
      "ecto.setup": ["ecto.create", "ecto.migrate"],
      "ecto.reset": ["ecto.drop", "ecto.setup"],
      "deps.get": ["deps.get", "gleam.deps.get"]
    ]
  end

  # Run "mix help compile.app" to learn about applications.
  def application do
    [
      extra_applications: [:logger, :ecto, :cowboy, :plug],
      mod: {PayCosern.Application, []}
    ]
  end

  # Run "mix help deps" to learn about dependencies.
  defp deps do
    [
      {:ecto_sql, "~>  3.6"},
      {:postgrex, ">=  0.0.0"},
      {:floki, "~> 0.35.0"},
      {:plug, "~>  1.12"},
      {:cowboy, "~>  2.9"},
      {:plug_cowboy, "~> 2.0"},
      {:jason, "~> 1.2.2"},
      {:wallaby, "~> 0.30", runtime: true},
      {:oban, "~> 2.16"},
      {:poolboy, "~> 1.5.2"},
      {:ecto_sqlite3, "~> 0.13"},
      {:timex, "~> 3.0"},
      {:argon2_elixir, "~> 4.0"},
      {:guardian, "~> 2.3.2"},
      {:gleam_stdlib, "~> 0.34 or ~> 1.0"},
      {:gleeunit, "~> 1.0", only: [:dev, :test], runtime: false}
    ]
  end
end

Screen gif

In this gif I first tried using the 'compilers' key. Then, I tried again with compilers commented and worked.

Screen recording (7)

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

1 participant