Skip to content

Instantly share code, notes, and snippets.

@scottlingran
Created September 8, 2012 09:26
Show Gist options
  • Save scottlingran/3673015 to your computer and use it in GitHub Desktop.
Save scottlingran/3673015 to your computer and use it in GitHub Desktop.
Useful command lines
### create new column in database model
$ rails generate migration add_column_to_<modelname> <column>:<class>
$ rake db:migrate

### drop a table from the database
$ rails c
$ ActiveRecord::Base.connection.drop_table :your_table_name

### using heroku
$ heroku run rake db:migrate
# runs on migration on heroku, otherwise you won't see shit on production

$ heroku run rake db:populate
# populates database

$ heroku run rails c
# runs the rails console on heroku, you can play with the database here

### Push dev datatabse to production on heroku

$ gem install taps
$ heroku run rake db:push
# https://devcenter.heroku.com/articles/taps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment