Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Hi, I wrote the post. We'd love to use transactions but our ORM doesn't support it. More info here: https://kev.inburke.com/kevin/dont-use-sails-or-waterline/

We wrote our own transaction library and have been shifting queries over to it/a saner ORM. https://github.com/shyp/pg-transactions.

I've never heard of database templates, I'll have to take a look.



If your ORM doesn't know about transactions, that doesn't necessarily prevent you from wrapping your test runs in transactions. I was in a situation where I needed to start / rollback a transaction without ActiveRecord knowing about it, and was able to hack AR slightly to make that work -- so you can likely do the same.

You even mention in the Waterline section of that blog post that you've written your own transaction library, so this shouldn't be too hard.


Or run your database on a RAM disk with snapshots (LVM, FS, block device, or virtual host based)


I would imagine resetting the whole db even on a RAM disk after each of 6000 tests wouldn't be particularly fast.


With snapshots, it should be instant.


One advantage of the template approach is it allows for test level parallelism, which may address your primary goal of performance.

> Waterline queries are case insensitive; that is, Users.find().where(name: 'FOO') will turn into SELECT * FROM users WHERE name = LOWER('FOO');. There's no way to turn this off. If you ask Sails to generate an index for you, it will place the index on the uppercased column name, so your queries will miss it. If you generate the index yourself, you pretty much have to use the lowercased column value & force every other query against the database to use that as well.

What the actual fuck!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: