Last active
August 29, 2015 14:28
-
-
Save timkellogg/e6e320c8a620831a0d13 to your computer and use it in GitHub Desktop.
Rake Tasks,
This file contains 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
http://jacopretorius.net/2014/02/all-rails-db-rake-tasks-and-what-they-do.html | |
http://guides.rubyonrails.org/active_record_basics.html | |
# many to many | |
class CreateEmployeesProjects < ActiveRecord::Migration | |
def change | |
create_table(:employees_projects) , id: false do |t| | |
t.column(:employee_id, :integer) | |
t.column(:project_id, :integer) | |
end | |
end | |
end | |
# add index | |
class AddIndexToEmployeesName < ActiveRecord::Migration | |
def change | |
add_index :employees, :lastname | |
end | |
end | |
# adding column | |
class AddBudgetToProjects < ActiveRecord::Migration | |
def change | |
add_column(:projects, :budget, :money) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment