Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rake_multi_db

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rake_multi_db

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

rake_multi_db_helper

Simple interactive rake task to automatically drop/migrate/drop & migrate/reset multiple databases

Installation

  1. Add gem 'rake_multi_db', '~> 0.0'to your application's Gemfile.

Usage

Simply run this rake task as you would any other rake task, from your rails project directory, using the multi_db: prefix and the appropriate tasks and parameters.

Parameters

The following parameters are able to be invoked

ParameterDefault ValueCommentExample
environmentstest,developmentA comma-seperated string of environments to work with.rake multi_db:drop environments=test,development
forcefalseWhether to forcefully progress if an error occurs,
without prompting the user.
rake multi_db:drop force=true

The following tasks are able to be used

TaskPurpose
dropDrops the specified environment's database.
migrateMigrates the specified environment's database from the relevant migration file.
redoDrops and migrates the specified environment's database.
resetResets all table data for the specified environment.

Arguments are passed as follows: rake multi_db:{Task} {parameter}={parameter_value}

i.e.

To drop specified environment databases:

rake multi_db:drop environments={environments_to_drop_comma_seperated}

To drop test and development databases:

rake multi_db:drop or rake multi_db:drop environments=test,development

To migrate all Test & Development databases:

rake multi_db:migrate or rake multi_db:migrate environments=test,development

To drop and migrate all Test & Development databases:

rake multi_db:redo or rake multi_db:redo environments=test,development

To reset all Test & Development databases

rake multi_db:reset or rake multi_db:reset environments=test,development

Things to keep in mind

  1. The value specified by RAILS_ENV is ignored entirely.

  2. When no environments are passed through to this rake task, it will automatically use both test and development environments. i.e. running rake multi_db:drop will drop all test and development databases. If you only want to drop, say, the test databases, specify an environment, as follows: rake multi_db:drop environments=test

  3. By default, when an error is encountered, the user will be asked to confirm whether they would like to continue. If you want to forcefully progress, and suppress all prompts, execute the rake task using the force parameter i.e. rake multi_db:drop environments=test,development force=true

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

FAQs

Package last updated on 22 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc