Hacker News new | ask | show | jobs
by Omie6541 1257 days ago
> It can write logic with JS (The more logic in DB the better.)

why the more logic in DB the better?

It's not visible to all devs, we can't put it in git, we can't write unit tests for the same!

1 comments

You can put it in git by writing the defined functions in a file.

You may use DB migration tools to run those.

It's better because logics in DB cannot be bypassed. If you write a logic or check in, say PHP, and part of your app is run in NodeJS, you have to duplicate those checks and logics. It even works when you interact with the database manually with some GUI tools which prevents you from manually inserting bad data.