diff options
| author | mo khan <mo@mokhan.ca> | 2015-05-19 07:55:04 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2015-05-21 21:26:10 -0600 |
| commit | e89bc7cb1467063ce65e3e78d77c8f4635132d0f (patch) | |
| tree | 4e7664935ebe396ac0b048e0421e15a034f15b61 /db | |
| parent | b769c085489679d362ccacd4e5d514f663379089 (diff) | |
create a workout record for each recors in the sqlite db.
Diffstat (limited to 'db')
7 files changed, 107 insertions, 1 deletions
diff --git a/db/migrate/20150519150012_create_workouts.rb b/db/migrate/20150519150012_create_workouts.rb new file mode 100644 index 0000000..906ba3b --- /dev/null +++ b/db/migrate/20150519150012_create_workouts.rb @@ -0,0 +1,10 @@ +class CreateWorkouts < ActiveRecord::Migration + def change + create_table :workouts, id: :uuid do |t| + t.uuid :user_id, null: false + + t.timestamps null: false + end + add_index :workouts, :user_id + end +end diff --git a/db/migrate/20150521220401_rename_workouts_to_training_sessions.rb b/db/migrate/20150521220401_rename_workouts_to_training_sessions.rb new file mode 100644 index 0000000..05ec4cc --- /dev/null +++ b/db/migrate/20150521220401_rename_workouts_to_training_sessions.rb @@ -0,0 +1,5 @@ +class RenameWorkoutsToTrainingSessions < ActiveRecord::Migration + def change + rename_table :workouts, :training_sessions + end +end diff --git a/db/migrate/20150521222240_create_exercise_workouts.rb b/db/migrate/20150521222240_create_exercise_workouts.rb new file mode 100644 index 0000000..f813b81 --- /dev/null +++ b/db/migrate/20150521222240_create_exercise_workouts.rb @@ -0,0 +1,27 @@ +class CreateExerciseWorkouts < ActiveRecord::Migration + def change + create_table :workouts, id: :uuid do |t| + t.uuid :program_id, null: false + t.string :name, null: false + t.timestamps null: false + end + + create_table :exercises, id: :uuid do |t| + t.string :name, null: false + t.timestamps null: false + end + + create_table :exercise_workouts, id: :uuid do |t| + t.uuid :exercise_id, null: false + t.uuid :workout_id, null: false + t.integer :sets, null: false + t.integer :repetitions, null: false + t.timestamps null: false + end + + create_table :programs, id: :uuid do |t| + t.string :name, null: false + t.timestamps null: false + end + end +end diff --git a/db/migrate/20150521231555_create_exercise_sessions.rb b/db/migrate/20150521231555_create_exercise_sessions.rb new file mode 100644 index 0000000..4467a4a --- /dev/null +++ b/db/migrate/20150521231555_create_exercise_sessions.rb @@ -0,0 +1,9 @@ +class CreateExerciseSessions < ActiveRecord::Migration + def change + create_table :exercise_sessions, id: :uuid do |t| + t.uuid :training_session_id, null: false + t.uuid :exercise_workout_id, null: false + t.timestamps null: false + end + end +end diff --git a/db/migrate/20150521234926_add_training_id_to_training_session.rb b/db/migrate/20150521234926_add_training_id_to_training_session.rb new file mode 100644 index 0000000..284fb00 --- /dev/null +++ b/db/migrate/20150521234926_add_training_id_to_training_session.rb @@ -0,0 +1,5 @@ +class AddTrainingIdToTrainingSession < ActiveRecord::Migration + def change + add_column :training_sessions, :workout_id, :uuid, null: false + end +end diff --git a/db/migrate/20150522004907_add_sets_to_exercise_sessions.rb b/db/migrate/20150522004907_add_sets_to_exercise_sessions.rb new file mode 100644 index 0000000..cb9aa69 --- /dev/null +++ b/db/migrate/20150522004907_add_sets_to_exercise_sessions.rb @@ -0,0 +1,5 @@ +class AddSetsToExerciseSessions < ActiveRecord::Migration + def change + add_column :exercise_sessions, :sets, :text, array: true, default: [] + end +end diff --git a/db/schema.rb b/db/schema.rb index f0d933e..20dda14 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,16 +11,61 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150124163233) do +ActiveRecord::Schema.define(version: 20150522004907) 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 "sets", default: [], array: true + end + + create_table "exercise_workouts", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t| + t.uuid "exercise_id", null: false + t.uuid "workout_id", null: false + t.integer "sets", null: false + t.integer "repetitions", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "exercises", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t| + t.string "name", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "programs", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t| + t.string "name", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "training_sessions", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t| + t.uuid "user_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.uuid "workout_id", null: false + end + + add_index "training_sessions", ["user_id"], name: "index_training_sessions_on_user_id", using: :btree + create_table "users", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t| t.string "username", null: false t.string "email", null: false t.string "password_digest" end + create_table "workouts", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t| + t.uuid "program_id", null: false + t.string "name", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + end |
