Add more fields to workout
This commit is contained in:
parent
6b377a577e
commit
1fc9dda21f
9 changed files with 57 additions and 5 deletions
11
db/migrate/20130810191419_add_fields_to_workout.rb
Normal file
11
db/migrate/20130810191419_add_fields_to_workout.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
class AddFieldsToWorkout < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :workouts, :comment, :text, :null => false, :default => ''
|
||||
add_column :workouts, :type, :string, :null => false, :default => 'Heavy'
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :workouts, :comment
|
||||
remove_column :workouts, :type
|
||||
end
|
||||
end
|
9
db/migrate/20130810192652_change_col_type_in_workouts.rb
Normal file
9
db/migrate/20130810192652_change_col_type_in_workouts.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
class ChangeColTypeInWorkouts < ActiveRecord::Migration
|
||||
def self.up
|
||||
rename_column :workouts, :type, :day_type
|
||||
end
|
||||
|
||||
def self.down
|
||||
rename_column :workouts, :day_type, :type
|
||||
end
|
||||
end
|
9
db/migrate/20130811021123_change_day_type_in_workotus.rb
Normal file
9
db/migrate/20130811021123_change_day_type_in_workotus.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
class ChangeDayTypeInWorkotus < ActiveRecord::Migration
|
||||
def self.up
|
||||
change_column_default :workouts, :day_type, 'heavy'
|
||||
end
|
||||
|
||||
def self.down
|
||||
change_column_default :workouts, :day_type, 'Heavy'
|
||||
end
|
||||
end
|
|
@ -11,12 +11,14 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20130810061810) do
|
||||
ActiveRecord::Schema.define(version: 20130811021123) do
|
||||
|
||||
create_table "workouts", force: true do |t|
|
||||
t.date "date"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.text "comment", default: "", null: false
|
||||
t.string "day_type", default: "heavy", null: false
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue