manelferreira / serverless-sequelize-migrations

A Serverless plugin to manage sequelize migrations
MIT License
21 stars 17 forks source link

Add support for passing host through the CLI #22

Closed alichherawalla closed 3 years ago

alichherawalla commented 3 years ago

Hi,

Thanks for this extremely helpful plugin, saved me a lot of time!

I store the RDS host in the Cloudfront output, referencing this output during the first deployment will cause it to break since there is no Cloudformation stack, hence adding it to the DB_HOST environment variable of the provider is not a feasible option. Referencing it using Fn::GetAtt doesn't seem to work with the plugin either.

While running migrations for AWS Aurora I trigger the migrations post a successful deploy, I have some custom code in place that allows us to fetch the host from the Cloudfront outputs, since this code executes post successful deployment the stack and the output exist for sure. I then pass the OutputValue as follows,

npx serverless migrations up --host=<host-value>

This PR is to allow the plugin to accept the host through the cli for such use cases.

manelferreira commented 3 years ago

Hi @alichherawalla , how are you? Hope everything is great!

I've just made the updates to support passing the database connection options through the CLI.

I will upload a new version on npm right now! Let me know if you notice any weird behavior.

Thank you very much!

alichherawalla commented 3 years ago

Doing well, thanks!

Will check this out asap. Thanks again for this great plugin