Created
April 12, 2017 22:23
-
-
Save JackHowa/ed9e579859ccecae49fc42ee675df051 to your computer and use it in GitHub Desktop.
20170412active_records-editing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pre-release: Set up Database with Old Schema | |
$ bundle install | |
$ bundle exec rake db:create | |
$ bundle exec rake db:migrate | |
bundle exec rake generate:migration NAME=RemoveWeightFromDogs | |
class RemoveWeightFromDogs < ActiveRecord::Migration | |
def change | |
remove_column :dogs, :weight | |
end | |
end | |
run that ... bundle exec rake db:migrate | |
bundle exec rake generate:migration NAME=AddBreedToDogs | |
add_column :breed | |
rails --generate migration add_breed_to_dogs breed:string | |
add_column :dogs, :breed, :string | |
add_index :dogs, :breed | |
has a integer column named judge_id (FAILED - 1) | |
no longer has a column named rater_id (FAILED - 2) | |
generate migration AddJudgeIdToRating judge_id:integer | |
lowercase id is important for constant error | |
bundle exec rake generate:migration NAME=DeleteRaterIDFromRatings |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment