Created
April 12, 2017 21:18
-
-
Save JackHowa/8ef59aad15a79a108499abb7c28b6c67 to your computer and use it in GitHub Desktop.
active record notes - week 3 = active-record-intro
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
Create the Database | |
bundle exec rake db:create | |
Check Database Version | |
bundle exec rake db:version | |
Run the Test Suite | |
bundle exec rake spec | |
Run the Migrations | |
bundle exec rake db:migrate | |
Populate the Database with Seed Data | |
bundle exec rake db:migrate | |
Open and Use the Console | |
bundle exec rake console | |
Rollback the Database | |
bundle exec rake db:rollback | |
Drop the Database | |
bundle exec rake db:drop | |
class CreateDogs < ActiveRecord::Migration | |
-active record migration method inheritance | |
t.timestamps | |
= | |
(t= table columns) | |
t.integer :created_at | |
t.integer :updated at | |
name of the migration file begins with a timestamp in the format YYYYMMDDHHMMSS: 20140901164300 | |
https://www.youtube.com/watch?v=cdgUhz2F0Mg - tunes Hans | |
bundle exec rspec spec/schema/people_table_spec.rb | |
bundle exec rake db:migrate | |
bundle exec rake generate:migration NAME=create_people | |
bundle exec rake generate:migration NAME=create_ratings | |
then ... I can run the migrate conversation whose skeleton I started | |
bundle exec rake db:migrate | |
bundle exec rake generate:migration NAME=create_ratings | |
rake db:rollback | |
migrate all bundle exec rake db:migrate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment