Artur-Sulej / excellent_migrations

An Elixir tool for checking safety of database migrations.
MIT License
232 stars 25 forks source link

Incorporate "Safe Ecto Migrations" Content Into Credo Checks Where Possible #36

Open Nezteb opened 9 months ago

Nezteb commented 9 months ago

Prominent Elixir dev @dbernheisel has talked about how to do safe Ecto migrations in a couple places online:

On a recent episode of the Thinking Elixir podcast, he talks again about safe migrations (the topic starts at 7:49 and ends at 18:46).

At 15:07 another host asks if David is planning on adapting his writings/recipes as credo checks. David says he probably won't and cites excellent_migrations as a good existing tool for this (that's how I ended up here 👋).

My question: As far as y'all can tell, do the credo checks in this repo cover most of the cases that David outlines in the above series/repo? I know some of what David suggests is hyper-specific to your own application, but it'd at least be nice if the "easy stuff" was covered in the credo checks!

Thanks!

Artur-Sulej commented 9 months ago

Hi, thanks for reaching out! It's great to hear that excellent_migrations are being talked about. According to stats at hex.pm, it seems that the lib has gained some popularity so far. I'm happy that people find it useful.

David's Safe Ecto Migrations guide is a valuable resource. I believe excellent_migrations cover all the checks listed there, along with those in strong_migrations plus some additional discoveries like volatile defaults. In the linked episode, David suggests using type :text instead of :string for columns. I'd like to explore this topic, because potentially it could be implemented as a new check in the library.

excellent_migrations are implemented in a generic way to find operation patterns in migrations for any application. I encourage you to give it a try. There are several integration methods. The easiest and most recommended one is credo check.