Hacker News new | ask | show | jobs
by raverbashing 4571 days ago
Changing code is one thing, changing the DB is another. A deployment that changes only the code is simpler than one that changes the DB.

How many DBs do you have? Testing (usually local), staging, production? For how many sites?

It works the same, if row['new_field'] do_something() else do_something_else()

You have unit tests to make sure it works.

And if it was so safer and easy to do it PostgreSQL wouldn't have added the json field.

1 comments

> A deployment that changes only the code is simpler than one that changes the DB.

In your experience, perhaps, but that's reversed in many other places.

As for everything else your point is only accurate if you assume that migrations are done by hand. If use a migration library it's impossible to forget to apply a migration to a database so there's no problem working with copies or even forks of databases.

> And if it was so safer and easy to do it PostgreSQL wouldn't have added the json field.

You're implying causation incorrectly: hstore and JSON are useful for cases where you explicitly do not want schema enforcement or can't afford the performance impact of normalization. This is not saying that migrations are hard, merely that not all problems have the same best solution.