Add position attribute to relation between exercise collection and exercises

This commit is contained in:
Maximilian Grundke
2018-07-03 15:23:00 +02:00
parent 0395d5b038
commit b68b3bc2b0
5 changed files with 31 additions and 11 deletions

View File

@@ -0,0 +1,13 @@
class CreateExerciseCollectionItems < ActiveRecord::Migration
def up
rename_table :exercise_collections_exercises, :exercise_collection_items
add_column :exercise_collection_items, :position, :integer, default: 0, null: false
add_column :exercise_collection_items, :id, :primary_key
end
def down
remove_column :exercise_collection_items, :position
remove_column :exercise_collection_items, :id
rename_table :exercise_collection_items, :exercise_collections_exercises
end
end