Geordi: Use load-dump script to source a database dump into your database
This script loads a dump into your development database.
You can provide the full path to you database dump like this:
load-dump path/to/my.dump
When you call load-dump
without any arguments it will show a menu with all dumps in your ~/dumps/
folder.
load-dump
This script is part of our geordi gem on github Show archive.org snapshot .
Related cards:
Script to create and copy a production dump to your project root
Soon after having written our shell-for script, we wanted to easily get dumps of our productions machines, too. This is how we do it:
dum...
How to load only a subset of a massive MySQL dump
I had a huge MySQL dump that took forever (as in: days) to import, while I actually just wanted to have the full database structure with some data to use on my development machine.
After trying several suggestions on how to speed up slow MySQL du...
Workflow: How to use a key management service to encrypt passwords in the database
This is an extract from the linked article. It shows an approach on how to implement encrypted passwords with the AWS Key Management Service (KMS).
For most applications it's enough to use a hashed...
ActiveRecord: How to use ActiveRecord standalone within a Ruby script
Re-creating a complex ActiveRecord scenario quickly without setting up a full-blown Rails app can come in handy e.g. when trying to replicate a presumed bug in ActiveRecord with a small script.
# Based on http://www.jonathanleighton.com/artic...
How to use Active Job to decouple your background processing from a gem
In a web application you sometimes have tasks that can not be processed during a request but need to go to the background.
There are several gems that help to you do that, like Sidekiq or [Resque](https://git...
Use a global .gitignore file to ignore stuff from your machine
Sometimes you want git to ignore certain files that appear on your machine. You can do this in 3 ways:
- Per project, in the project's
.gitignore
file - Per project, in [a local exclude file](https://makandracards.com/makandra/3201-how-to-ignor...
MySQL: How to dump single tables instead of a complete database
Sometimes you want to test migrations with production or staging data. Dumping single tables makes sense if a complete dump would be to big.
mysqldump -u deploy_user -p application_production table1 table2 table2 > table1_table2_table2.sql.du...
How to load an SQL dump from a migration
If you want to load an SQL dump from an ActiveRecord migration, you might find this to be harder than you thought. While you can call ActiveRecord::Base.connection.execute(sql)
to execute arbitrary SQL commands, the MySQL connection is configure...
Best practices: Writing a Rails script (and how to test it)
A Rails script lives in lib/scripts and is run with bin/rails runner lib/scripts/...
. They are a simple tool to perform some one-time actions on your Rails application. A Rails script has a few advantages over pasting some prepared code into a R...
Rails: How to restore a postgres dump from the past
It sometimes happen that a database dump, that would want to insert into your development database, does not match the current schema of the database. This often happens when you have an old dump, but your current setup is up to date with the the ...