postmanlabs / sails-mysql-transactions

sails/waterline ORM with mySQL transaction support
Apache License 2.0
59 stars 20 forks source link

Use sails hook to inject Warerline ORM #31

Open shamasis opened 8 years ago

shamasis commented 8 years ago

Currently the modified waterline is injected using scripts. This is non standard. Replace it with https://github.com/balderdashy/sails-hook-orm

bblpny commented 8 years ago

I think this is the most important issue. I'd like to help out but am unsure about the manor of injecting another version of waterline at runtime. Would it literally be doing the same thing as the post install script?

mikermcneil commented 8 years ago

I'd like to help out but am unsure about the manor of injecting another version of waterline at runtime

@bblpny it should be ok-- Waterline keeps its hands off the globals for the most part. The only exception is how the actual adapters are set up (not their fault-- just because they manage connection state).

@shamasis @bblpny re: replacing the ORM hook as a simple example, there's sails-hook-orm-mongoose (which really ought to be called sails-hook-mongoose since it does not provide complete feature parity w/ the built-in orm hook-- i.e. blueprints won't work and you have to look at mongoose's docs for models)

More presciently, I got a start on extrapolating the core orm hook here. That one is designed to be at 100% parity, although I haven't had the opportunity to thoroughly test it yet (needs to be hooked up to sails core and run w/ the tests).

I think the best place to start on this is probably to do a sanity check of the standalone hook (sails-hook-orm). At that point, all that should be necessary is to change the Waterline dependency in the package.json of sails-hook-orm to point at the fork.

Hoping to get a chance to try this out myself soon once we finish the work we're doing in the adapters. In the mean time I'll stay tuned :) Thanks for the help guys!

bblpny commented 8 years ago

@mikermcneil thank you for your reply. I'm familiar with writing hooks and will take a look at the examples you've posted.

svenvarkel commented 8 years ago

This custom postinstall.sh script fails when I'm trying to deploy my application to AWS EB environment. Will the standard approach with hooks resolve this problem?

shamasis commented 8 years ago

@svenvarkel - it would. But we use this on EB with no problem. What error are you facing?

svenvarkel commented 8 years ago

It somehow magically started working. I'm using my own fork in package.json