natewallis

natewallis

Hi..

I am having a bit of ecto-phobia.. if this term catches on, please send royalties my way…

I have used rails in the past and played with ActiveRecord and now moving into Ecto for my Elixir projects. I have no doubts that the Ecto API is solid but I have always feel like I might be painting myself into a corner when I use Ecto and never sure about how locked down my database design needs to be before I venture into ecto-land.. I have my design down on paper, but I am always worried about changing a column name later on and what impacts that will have on my code.

Is it possible to get to a point of no return with Ecto and similar tools?

Maybe I just need to be told that everythings “gonna be alright”! Happy new year all..

First Post!

mischov

mischov

I haven’t had problems with things like changing column names when using Ecto- a migration and a change to the schema and I’m good to go[^1].

[^1] : As others have pointed out, renaming columns isn’t quite as simple as that, but that’s not a problem Ecto makes any worse.

Most Liked

natewallis

natewallis OP

Thanks for the replies.. this took a direction I wasn’t expecting.. looks like I have some reading to do!

BTW - I have overcome my fear of commitment and started with Ecto. I think I was throwing myself off by using phx.gen.html when I should have been building my migrations and schemas from the ground up so that I understood it better.. lesson learnt.

Till next time!

bobbypriambodo

bobbypriambodo

Less about Ecto but database design of a complex systems is a tough task overall. Modifying tables (e.g. adding, renaming, indexing columns) can get messy when you’re in the millions of rows :smile: I also always have the anxiety, that little 10% of my mind thinking “what if I had designed this all wrong?”

IMO there’s nothing you can do about it other than to always be ready for change and perhaps consult to a domain expert to make sure you get the terms right (therefore less likely to rename columns; I like to think DB column names are like an API; you’re expected to do some work if it changes).

fxn

fxn

Database schemas evolve as applications evolve, new tables, new columns, new constraints, drops, renames…

That is normal and to be expected. But think that if the schema changes, you’ll need to edit the code no matter what. Either Ecto, or hard-coded SQL, or stored procedures that depend on it. None of these things auto-update. Renaming a column is not just a SQL statement, it needs maintenance and coordination wherever the column is being used. It may even require multiple deploys if you may have old and new code cooexisting for a moment in a rolling start.

To me, something like Ecto (or AR) is a catalyzer. You know the SQL you need, you could write it by hand. But you instead leverage these tools to have the SQL robustly generated on your behalf, using Elixir code that is more understandable most of the times because of the higher-level API it is expressed in.

Then, occasionally the SQL you need is just too complicated, then you resort to raw SQL.

Embrace Ecto! Yes, it is gonna be alright :).

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews