# Remove addon
heroku addons:remove cleardb
# Set DATABASE_URL back to PG
heroku config | grep SHARED_DATABASE_URL # => postgres://XXX
heroku config:add DATABASE_URL='postgres://XXX'
Friday, June 8, 2012
Switch database from MySQL (ClearDB addon) back to PostgresSQL in Heroku
Had permission problems using ClearDB and figure it wasn't worth all the hassle of adding another layer of abstraction/configuration when Heroku already works with PostgreSQL out of the box. Here's how to switch back to PG.
Wednesday, June 6, 2012
ClearDB MySQL on Heroku gotcha
Didn't know that a rails project deployed on heroku was using ClearDB MySQL as production database - I just assumed that it's PostgreSQL on Heroku till I saw that ClearDB addon was used. Removing the addon and mysql gems and configuring config/database.yml did not saw the application switched back to PG. Read the ClearDB addon and realized that DATABASE_URL environment was set.
https://devcenter.heroku.com/articles/cleardb
https://devcenter.heroku.com/articles/cleardb
Wednesday, May 30, 2012
Quickly checkout Git remote branch into a local branch
git checkout -b LOCAL_BRANCH origin/REMOTE_BRANCH
Friday, May 18, 2012
Codeblocks for Markdown
From Daring Fireball:
To produce a code block in Markdown, simply indent every line of the block by at least 4 spacesAt least 4 spaces... so that means 2 tabs if your tab is set to 2 spaces.
SQL dump for MySQL databases
backup:
mysqldump -u root DATABASE_NAME > sqldump.sql
restore:
mysql -u root DATABASE_NAME < sqldump.sql
Monday, May 7, 2012
Search and replace words in multiple files in Vim
Upgraded my project's factory girl and got some nasty warnings about Factory(:xxx) and Factory.create(:xxx) syntax being deprecated. I've been using the former for almost all of the specs so needed an easy way to search and replace words in multiple files in Vim.
:args app/models/*
:argdo %s/Factory(:/FactoryGirl.create(:/ge | update
Wednesday, March 28, 2012
Differences in Ruby's loading methods
load() - loads and reloads indiscriminately
autoload() - only loads when classes inside are first called upon
require() - loads only once, further calls are ignored
require_relative() - same as require() except file paths are explicitly relative
autoload() - only loads when classes inside are first called upon
require() - loads only once, further calls are ignored
require_relative() - same as require() except file paths are explicitly relative
Subscribe to:
Comments (Atom)