diff options
| author | mo khan <mo@mokhan.ca> | 2016-06-11 11:37:38 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2016-06-11 11:37:38 -0600 |
| commit | 976a80768046c36b3adeefa4a730c2652a15b49b (patch) | |
| tree | 06231f03fea1e8ead1208380caf6daedba2a4c90 /db | |
| parent | 9c79f5eff10107386f90d509f32dcd9e9aa89107 (diff) | |
remove old fields and fix constraints.
Diffstat (limited to 'db')
| -rw-r--r-- | db/migrate/20160611165128_create_exercise_sets.rb | 6 | ||||
| -rw-r--r-- | db/migrate/20160611171913_remove_fields_from_exercise_sessions.rb | 19 | ||||
| -rw-r--r-- | db/schema.rb | 26 |
3 files changed, 33 insertions, 18 deletions
diff --git a/db/migrate/20160611165128_create_exercise_sets.rb b/db/migrate/20160611165128_create_exercise_sets.rb index d2b207e..bb2476e 100644 --- a/db/migrate/20160611165128_create_exercise_sets.rb +++ b/db/migrate/20160611165128_create_exercise_sets.rb @@ -2,9 +2,9 @@ class CreateExerciseSets < ActiveRecord::Migration def change create_table :exercise_sets, id: :uuid do |t| t.uuid :exercise_session_id, null: false - t.integer :target_repetitions - t.integer :actual_repetitions - t.float :target_weight + t.integer :target_repetitions, null: false + t.integer :actual_repetitions, null: false, default: 0 + t.float :target_weight, null: false t.timestamps null: false end diff --git a/db/migrate/20160611171913_remove_fields_from_exercise_sessions.rb b/db/migrate/20160611171913_remove_fields_from_exercise_sessions.rb new file mode 100644 index 0000000..91f87e3 --- /dev/null +++ b/db/migrate/20160611171913_remove_fields_from_exercise_sessions.rb @@ -0,0 +1,19 @@ +class RemoveFieldsFromExerciseSessions < ActiveRecord::Migration + def up + change_table :exercise_sessions do |t| + t.remove :actual_sets + t.remove :target_repetitions + t.remove :target_sets + t.remove :target_weight + end + end + + def down + change_table :exercise_sessions do |t| + t.text :actual_sets, array: true, default: [] + t.integer :target_repetitions + t.integer :target_sets + t.integer :target_weight + end + end +end diff --git a/db/schema.rb b/db/schema.rb index c1be936..1f26106 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,30 +11,26 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160611165543) do +ActiveRecord::Schema.define(version: 20160611171913) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" enable_extension "uuid-ossp" create_table "exercise_sessions", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t| - t.uuid "training_session_id", null: false - t.uuid "exercise_workout_id", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.text "actual_sets", default: [], array: true - t.float "target_weight" - t.integer "target_sets", default: 5, null: false - t.integer "target_repetitions", default: 5, null: false + t.uuid "training_session_id", null: false + t.uuid "exercise_workout_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "exercise_sets", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t| - t.uuid "exercise_session_id", null: false - t.integer "target_repetitions" - t.integer "actual_repetitions" - t.float "target_weight" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.uuid "exercise_session_id", null: false + t.integer "target_repetitions", null: false + t.integer "actual_repetitions", default: 0, null: false + t.float "target_weight", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "exercise_workouts", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t| |
