Duplicate extension migrations when using multiple repos
Current Behavior
When adding a new extension with igniter that requires a migration the tool generate the migration for each repo defined in the project causing a migration error
Reproduction
https://github.com/wildcant/multi-repo-extension-duped-migration
Expected Behavior
Quoting Zach: "we probably want some kind of migrate_extensions? false callback on the repo"
The fix here is likely to add a callback like migrate_extensions? that users can set to false to bypass this issue.
Okay so I checked this and this can be reproduced without adding the extra repo. When rolling back the money type is still there, so when you migrate again the CREATE TYPE fails. Solution that worked was adding at the bottom of down part:
execute "DROP TYPE IF EXISTS public.money_with_currency CASCADE;"
then you can rollback and migrate willy-nilly. @zachdaniel wdyt?
Then maybe we've got a bug in ash_money is all
Then maybe we've got a bug in ash_money is all
Yeah I think it's that. I'll make a PR with the cascade type delete
what would be the work around to scaffold a new project with the ash-money and magiclink components? Should I just start with a basic ash project and add components 1 by 1?
getting a similar issue with the magiclink option:
15:00:49.251 [info] == Running 20250821220047 foobar.Repo.Migrations.InitializeAndAddAuthenticationResourcesAndAddMagicLinkAuthAndAddApiKeyAuth.up/0 forward
15:00:49.251 [info] create table users
** (Postgrex.Error) ERROR 42P07 (duplicate_table) relation "users" already exists
(ecto_sql 3.13.2) lib/ecto/adapters/sql.ex:1098: Ecto.Adapters.SQL.raise_sql_call_error/1
(elixir 1.18.4) lib/enum.ex:1714: Enum."-map/2-lists^map/1-1-"/2
using this command from the website:
sh <(curl 'https://ash-hq.org/install/foobar?install=phoenix') \
&& cd vombat && mix igniter.install ash ash_phoenix \
ash_graphql ash_postgres ash_authentication \
ash_authentication_phoenix ash_csv ash_admin ash_oban \
oban_web ash_state_machine ash_events ash_archival \
live_debugger mishka_chelekom tidewave ash_paper_trail \
ash_ai cloak ash_cloak ash_money --auth-strategy magic_link \
--auth-strategy api_key --yes && mix ash.setup
That particular issue is unrelated to this issue. You can run mix ash.reset in that project. You just already have a database called foobar_dev. We should probably add some kind of install check and prompt the user to manually reset or migrate instead of just trying to run it and failing.