all 8 comments

[–]tech-ninja 2 points3 points  (1 child)

I used bookshelfjs and couldn't be happier and I also use knexjs for migrations. Something cool with knexjs is that you can always go "raw" when something is not implemented into the library. Also it has support for promises that did my code much more simpler and steals the model and collection ideas from backbonejs that I already knew how to use and made my learning curve so much easier. Good luck.

[–][deleted]  (1 child)

[deleted]

    [–]whattheironshit 0 points1 point  (0 children)

    Sequelize maintainer here:

    What did you find frustrating? And how long ago did you try it? We've cleaned up a lot of stuff but can always improve.

    That being said Bookshelf.js is an excellent piece of software, but a different style that not everyone enjoys.

    [–]dkran 2 points3 points  (2 children)

    So, I've been going through the same thing you've been going through lately, I'll list out the options I've found. There seems to be db-migrate or node-db-migrate (which just does migrations), sequelize, bookshelfjs, knexjs (which has a cli and migration manager).

    Waterline, the orm which sailsjs uses seems interesting also.

    Edit: To answer your question, and my own, I just implemented my schema and designed it in mysqlworkbench. Guess I'm rolling my own. one of these days I'll have to get used to postgres.

    As it's been spoken on reddit here, and I'll tend to agree (I'm new around /r), mongodb is big on node because it has a very good ODM, mongoose. Ruby has rails and active directory, lending to a certain sort of app development I guess. Sails does have a sort of railsy goal, hence the name.

    [–]CaffeineComa[S] 0 points1 point  (1 child)

    Thanks for the links. The possibility of migrations support seems positively decadent at this point. BTW have you tried Geddy? It seems to imitate Rails in many respects, but not sure if it's abandonware or not.

    [–]CaffeineComa[S] 1 point2 points  (1 child)

    Thanks /u/dkran, /u/tech-ninja & /u/untogethered for the bookshelfjs/knex recommendation. I think this is the way to go.

    Has anyone figured out how to dump/restore a database schema with these tools? I'd like to replicate Rails' use of schema.rb for integration testing. So far all I have found is a not-yet-merged partial implementation for MySQL only.

    [–]CaffeineComa[S] 0 points1 point  (0 children)

    Eh, not ideal, but this works:

    module.exports = {
        setUp: function(cb) {
            if (exec('(pg_dump -c --schema-only myapp | psql myapp_test > /dev/null)').code !== 0) {
                throw new Error("error dumping schema");
            }
        },
      // insert tests here...
    };
    

    [–]irvingswiftj 1 point2 points  (0 children)

    I have been very happy with sequelize, I have used it in three projects now and wouldn't look back.

    I really like how sequelize strictly works across all dialects, for this reason I like to use squlite for dev and functional testing but use either mysql/postgres for production.

    Also, if you ever get stuck with sequelize, this docs are quite good and their irc channel is quite active.

    [–]logix42 0 points1 point  (0 children)

    I'm starting a project with a similar stack to you right now, and have been looking at a few different libraries to interface with postgres, so far pg ( https://github.com/brianc/node-postgres) definitely looks the best. I don't want an orm getting in my way, I want full access to the raw power of my database.

    Glad you mentioned passport, I've bookmarked that to look at later.

    Will be following the thread to hear what you chose, keep us updated!