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

pgreset

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pgreset

  • 0.4
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

pgreset

The pgreset gem makes it possible to run rails db:reset against a postgres database with active connections. It should eliminate "database in use" errors from rails.

Credit for the original solution goes to Manuel Meurer.

Special thanks to Emil Kampp, Michael Yin, and Kate Donaldson for adding Rails 6.1 support.

Installation and Usage

Add this line to your application's Gemfile:

gem 'pgreset'

And then execute:

$ bundle

Or install it yourself as:

$ gem install pgreset

Now you can run rails db:reset as normal, and rails will kill active connections to the database being reset:

$ rails db:reset

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

Testing

There's a script called pgreset-test.sh that can test a local copy of pgreset against various versions of ruby and rails. The script assumes postgres is listening on a socket at /tmp/.s.PGSQL.5432 and accepts connections for a user with no password, and that rvm is installed. You should at least test against these versions, since there were breaking changes to pgreset in them (replace PG_USER with your postgres username):

cd /path/to/your/pgreset/clone
./pgreset-test.sh 3.0.4 6.0.4 PG_USER
./pgreset-test.sh 3.1.2 7.0.8 PG_USER
./pgreset-test.sh 3.1.2 7.1.1 PG_USER

Releasing

To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/dafalcon/pgreset.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 12 Oct 2023

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