We removed `db:test:prepare` from the `migrate` alias in #260 because
Rails 4.1 discouraged users from running the deprecated (at the time)
Rake task. Rails brought back `db:test:load` in rails/rails#17739 due to
user complaints about being unable to force a test database
synchronization.
Without dropping and recreating the test database from scratch, the
current migration strategy of solely using `db:migrate` and
`db:rollback` will never bring changes into test from a migration that
was run, rolled back, modified, and then re-run.
Running `db:test:load` or `db:test:prepare` on each migrate operation
has a small performance penalty, but the task is only being run when you
have a reason to want to check or force a synchronization of the
database. Knowing for sure that your test and development databases are
at the same point in their evolution is worthwhile.
Running `db:test:prepare` or `db:test:load` after running our existing
migrate alias added just under 1.0 seconds on average to the migrate
operation on an application with a reasonably sized DB schema.
diff --git a/aliases b/aliases index 6a0f602..102caca 100644 ---
a/aliases +++ b/aliases @@ -9,7 +9,7 @@ alias v="$VISUAL" alias
b="bundle"
# Rails
-alias migrate="rake db:migrate db:rollback && rake db:migrate"
+alias migrate="rake db:migrate db:rollback && rake db:migrate db:test:prepare"
alias s="rspec"
# Pretty print the path
A few aliases contain references to environment variables, but were
defined using double quotes. This caused zsh to interpolate the value of
those variables when the alias was defined instead of when it was
executed. In particular, any change to `PATH` (or `EDITOR` or `VISUAL`)
in `.zshrc.local`, which is sourced after `.aliases`, would not be
reflected in these aliases.
This commit defines these aliases using single quotes so that the
environment variables are evaluated when the alias is executed.
Often mistyping things like `gi tst` causes `gi` alias to trigger the install of
the `tst` gem. This is quite annoying and too close to `git` command which we
run much more often than `gem install`. With bundler we should almost never run
`gem install`.
With arguments, g acts like git.
Without arguments, it runs `git status`.
* Source functions/* after loading ZSH completion so `compdef` is available to g
alias
* Use a regular alias to make `s` short for `rspec`
* Use an `rspec` shell function to route to zeus when appropriate
* Removes confusion from `s` working differently than `rspec`
* Removes need to use a special alias to get zeus working
staging:
staging console
staging migrate
staging process
staging open
watch staging ps
staging tail
production:
production backup
production console
production migrate
production open
watch production ps
production tail
load-backup-into:
load-backup-into staging
load-backup-into development
Notes on the last command:
* Copy latest production database backup into development database using
preferred pgbackups + pg_restore method recommended by Heroku.
* Do not assume local development database name.
* Get local database name from config/database.yml.
* This did not previously exist in dotfiles.
Supporting change for these commands:
* Add ~/.bin to the PATH.
https://github.com/thoughtbot/dotfiles/pull/76