Add more fields to workout

This commit is contained in:
Andrew Tomaka 2013-08-10 22:15:26 -04:00
parent 6b377a577e
commit 1fc9dda21f
9 changed files with 57 additions and 5 deletions

View 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

View 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

View 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

View file

@ -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