Skip to content

Instantly share code, notes, and snippets.

@tbogin
Last active October 7, 2016 16:08
Show Gist options
  • Save tbogin/48bcb90ca27dabc1f2cd8823cf10d990 to your computer and use it in GitHub Desktop.
Save tbogin/48bcb90ca27dabc1f2cd8823cf10d990 to your computer and use it in GitHub Desktop.
Migrating a Rails app from SQLite to Postgres

##Migrate a SQLite app to PostgreSQL in order to deploy to Heroku ###Continue only if you're fine dropping your existing database.

  1. Make a new, empty rails app with PostgreSQL: $rails new app_name --database=postgresql
  2. Copy the database.yaml file of your brand new app, and paste it in your old app, replacing the old app's database.yaml file
  3. Throughout database.yaml, replace the new app’s name with the old app's name
  4. $bundle update, $db:create, $db:migrate
  5. Yay!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment