diff --git a/app/models/experiment.rb b/app/models/experiment.rb index 5b9b06e20..1dc014444 100644 --- a/app/models/experiment.rb +++ b/app/models/experiment.rb @@ -3,7 +3,7 @@ class Experiment < ActiveRecord::Base belongs_to :project, inverse_of: :experiments belongs_to :created_by, foreign_key: :created_by_id, class_name: 'User' - belongs_to :updated_by, foreign_key: :updated_by_id, class_name: 'User' + belongs_to :last_modified_by, foreign_key: :last_modified_by_id, class_name: 'User' belongs_to :archived_by, foreign_key: :archived_by_id, class_name: 'User' belongs_to :restored_by, foreign_key: :restored_by_id, class_name: 'User' @@ -17,7 +17,7 @@ class Experiment < ActiveRecord::Base validates :description, length: { maximum: 255 } validates :project, presence: true validates :created_by, presence: true - validates :updated_by, presence: true + validates :last_modified_by, presence: true with_options if: :archived do |experiment| experiment.validates :archived_by, presence: true experiment.validates :archived_on, presence: true diff --git a/db/migrate/20160722082700_add_experiment_level.rb b/db/migrate/20160722082700_add_experiment_level.rb index 73af7ebeb..5ee783e09 100644 --- a/db/migrate/20160722082700_add_experiment_level.rb +++ b/db/migrate/20160722082700_add_experiment_level.rb @@ -6,7 +6,7 @@ class AddExperimentLevel < ActiveRecord::Migration t.text :description t.integer :project_id, null: false t.integer :created_by_id, null: false - t.integer :updated_by_id, null: false + t.integer :last_modified_by_id, null: false t.boolean :archived, null: false, default: false t.integer :archived_by_id t.datetime :archived_on @@ -16,13 +16,13 @@ class AddExperimentLevel < ActiveRecord::Migration t.timestamps null: false end add_foreign_key :experiments, :users, column: :created_by_id - add_foreign_key :experiments, :users, column: :updated_by_id + add_foreign_key :experiments, :users, column: :last_modified_by_id add_foreign_key :experiments, :users, column: :archived_by_id add_foreign_key :experiments, :users, column: :restored_by_id add_index :experiments, :name add_index :experiments, :project_id add_index :experiments, :created_by_id - add_index :experiments, :updated_by_id + add_index :experiments, :last_modified_by_id add_index :experiments, :archived_by_id add_index :experiments, :restored_by_id @@ -41,7 +41,7 @@ class AddExperimentLevel < ActiveRecord::Migration name: 'Test experiment', project: project, created_by: owner, - updated_by: owner + last_modified_by: owner ) # Assign all modules onto new experiment @@ -100,11 +100,11 @@ class AddExperimentLevel < ActiveRecord::Migration remove_index :experiments, column: :name remove_index :experiments, column: :project_id remove_index :experiments, column: :created_by_id - remove_index :experiments, column: :updated_by_id + remove_index :experiments, column: :last_modified_by_id remove_index :experiments, column: :archived_by_id remove_index :experiments, column: :restored_by_id remove_foreign_key :experiments, column: :created_by_id - remove_foreign_key :experiments, column: :updated_by_id + remove_foreign_key :experiments, column: :last_modified_by_id remove_foreign_key :experiments, column: :archived_by_id remove_foreign_key :experiments, column: :restored_by_id drop_table :experiments diff --git a/db/schema.rb b/db/schema.rb index 0534e6020..fa23e0e64 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -142,7 +142,7 @@ ActiveRecord::Schema.define(version: 20160722082700) do t.text "description" t.integer "project_id", null: false t.integer "created_by_id", null: false - t.integer "updated_by_id", null: false + t.integer "last_modified_by_id", null: false t.boolean "archived", default: false, null: false t.integer "archived_by_id" t.datetime "archived_on" @@ -157,7 +157,7 @@ ActiveRecord::Schema.define(version: 20160722082700) do add_index "experiments", ["name"], name: "index_experiments_on_name", using: :btree add_index "experiments", ["project_id"], name: "index_experiments_on_project_id", using: :btree add_index "experiments", ["restored_by_id"], name: "index_experiments_on_restored_by_id", using: :btree - add_index "experiments", ["updated_by_id"], name: "index_experiments_on_updated_by_id", using: :btree + add_index "experiments", ["last_modified_by_id"], name: "index_experiments_on_last_modified_by_id", using: :btree create_table "logs", force: :cascade do |t| t.integer "organization_id", null: false @@ -662,7 +662,7 @@ ActiveRecord::Schema.define(version: 20160722082700) do add_foreign_key "experiments", "users", column: "archived_by_id" add_foreign_key "experiments", "users", column: "created_by_id" add_foreign_key "experiments", "users", column: "restored_by_id" - add_foreign_key "experiments", "users", column: "updated_by_id" + add_foreign_key "experiments", "users", column: "last_modified_by_id" add_foreign_key "logs", "organizations" add_foreign_key "my_module_comments", "comments" add_foreign_key "my_module_comments", "my_modules"