Ash_sqlite generated migrations

Hey team

I’m building a new ash phoenix app with a sqlite3* backend (everything up-to-date, mix hex-outdated shows all green). Because I’m early in the development process my resources are changing a lot as I “explore the domain”.

I keep running into issues where the auto-generated migrations (i.e. mix ash_sqlite.generate_migrations) try and do things which would work fine in postgres but don’t work in sqlite3 (here’s one example, but I’ve run into a few different similar scenarios).

My current workflow is to

  1. sigh heavily
  2. delete all the migrations and resource_snapshots in the app
  3. mix ecto.reset
  4. start again with a new mix ash_sqlite.generate_migrations

It’s kindof cheating, but since I’m still early in the development (nothing deployed to prod yet) I can get away with it.

I can think of a few ways I could do things differently:

  1. modify the generated migrations to use the various workarounds required to make sqlite3 actually do the things (may require executeing a bunch of raw SQL in the migrations, but I’m ok with that)
  2. modify the generate_migrations task so that it automatically applies the workarounds (happy to contribute these upstream, too - but I’m not sure how robust the detection will be and I’m not sure you wanna go down the “apply hacky workarounds” path with ash_sqlite)
  3. never make these breaking changes to the tables, and just work around things in app code (might be necessary in an existing app which can’t tolerate the downtime, etc, but that’s not my situation - so I don’t want to go down this path)
  4. switch to postgres :wink:
  5. some other option I’m missing?

Anyway thanks heaps for all your work on Ash - it’s an amazing stack, and I don’t mean to complain. Just want to know the best way forward given my situation.

*why ash_sqlite? I’m working on several small “proof of concept” apps, none of which have “precious” data, and I love the ops simplicity of using sqlite. And although I haven’t heard much from the litefs crew recently I do like that idea (since my apps all on fly anyway). So I’d rather not take option #4, and given that `ash_sqlite_ is a thing I guess you want to provide the sqlite option.