"No changes detected, so no migrations or snapshots have been created."

Hi all. I am learning how to build a simple CRUD app with Ash, and for some reason mix ash_postgres.generate_migrations fails to pick up any migrations, even after I mix ash_postgres.drop and rm -f priv/repo/migrations/* to start from scratch. Any clues as to why?
13 Replies
ZachDaniel
ZachDaniel3y ago
AshPostgres uses "snapshots" to track the current state of the tables it is generating migrations for So you'll also want to remove those 🙂 they default to priv/repo/snapshots IIRC
waseigo
waseigoOP3y ago
I have a priv/resource_snapshots/repo, but no priv/repo/snapshots Ok, now it generates the users and tokens table for ash_authentication, but not the tables based on my resources
ZachDaniel
ZachDaniel3y ago
You are likely missing either 1. an api in config :your_app, :ash_apis 2. resources in the registry for an api
waseigo
waseigoOP3y ago
config :bouketo,
ash_apis: [Bouketo.Portfolio]

config :bouketo,
ash_apis: [Bouketo.Accounts]
config :bouketo,
ash_apis: [Bouketo.Portfolio]

config :bouketo,
ash_apis: [Bouketo.Accounts]
I think that was the problem, let me make one list and try it out Excellent, thank you @Zach Daniel!
ZachDaniel
ZachDaniel3y ago
My pleasure 🙂 If your issue has been resolved, please add the ✅ Solved tag and close this thread by right clicking the thread in the sidebar and choosing Close Post.
waseigo
waseigoOP3y ago
For reference, besides the copy/past error I had made, I now enter the following sequence of commands in order to start from a clean slate:
rm -rf ./priv/repo/migrations/*
rm -rf ./priv/resource_snapshots/*
mix ash_postgres.drop
mix ash_postgres.create
mix ash_postgres.generate_migrations
mix ash_postgres.migrate
mix run priv/repo/seeds.exs
rm -rf ./priv/repo/migrations/*
rm -rf ./priv/resource_snapshots/*
mix ash_postgres.drop
mix ash_postgres.create
mix ash_postgres.generate_migrations
mix ash_postgres.migrate
mix run priv/repo/seeds.exs
ZachDaniel
ZachDaniel3y ago
Someone had a clever script for something like this
ZachDaniel
ZachDaniel3y ago
you'd want to modify it to do your seeds.exs as well
waseigo
waseigoOP3y ago
I nuke everything and start from scratch with my reset.sh containing the commands above Trying to wrap my head around Ash, so it's easier to reset to a blank slate...
ZachDaniel
ZachDaniel3y ago
👍
axdc
axdc3y ago
not sure about necro etiquette, but just wanted to add my 3am brain was struggling with this for like an hour, comparing the working and non-working resources over and over, the madness slowly rising, giddy cackles escaping my throat, etc, then i realized i simply hadn't prefixed the resources with "entry" in the non-detected registry. duh. the system didn't flag it as invalid or anything and i skimmed right over it. so check that first as extremely low-hanging fruit, future traveler. (please kill or move this if it's inappropriate here)
ZachDaniel
ZachDaniel3y ago
oh man, thats crazy lol. Thanks for adding that context!

Did you find this page helpful?