From f211e47eb20959fdebc5ae0aabf66267ea521ee7 Mon Sep 17 00:00:00 2001 From: haseeb Date: Fri, 9 Feb 2018 23:53:55 +0530 Subject: closed by field added --- db/migrate/20180209165249_add_closed_by_to_issues.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 db/migrate/20180209165249_add_closed_by_to_issues.rb (limited to 'db') diff --git a/db/migrate/20180209165249_add_closed_by_to_issues.rb b/db/migrate/20180209165249_add_closed_by_to_issues.rb new file mode 100644 index 00000000000..043e3ef8688 --- /dev/null +++ b/db/migrate/20180209165249_add_closed_by_to_issues.rb @@ -0,0 +1,13 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddClosedByToIssues < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + def change + add_column :issues, :closed_by_id, :integer + end +end -- cgit v1.2.1 From 9b0e8a09b1b35cc8fc893003afc59c78f5dc846f Mon Sep 17 00:00:00 2001 From: haseeb Date: Tue, 27 Feb 2018 21:48:01 +0530 Subject: added forign key and specs --- db/migrate/20180209165249_add_closed_by_to_issues.rb | 9 ++++++++- db/schema.rb | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'db') diff --git a/db/migrate/20180209165249_add_closed_by_to_issues.rb b/db/migrate/20180209165249_add_closed_by_to_issues.rb index 043e3ef8688..e251afd7b49 100644 --- a/db/migrate/20180209165249_add_closed_by_to_issues.rb +++ b/db/migrate/20180209165249_add_closed_by_to_issues.rb @@ -4,10 +4,17 @@ class AddClosedByToIssues < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! # Set this constant to true if this migration requires downtime. DOWNTIME = false - def change + def up add_column :issues, :closed_by_id, :integer + add_concurrent_foreign_key :issues, :users, column: :closed_by_id, on_delete: :nullify + end + + def down + remove_foreign_key :issues, column: :closed_by_id + remove_column :issues, :closed_by_id end end diff --git a/db/schema.rb b/db/schema.rb index 5bb461169f1..cb4362a5306 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -876,6 +876,7 @@ ActiveRecord::Schema.define(version: 20180216121030) do t.integer "last_edited_by_id" t.boolean "discussion_locked" t.datetime_with_timezone "closed_at" + t.integer "closed_by_id" end add_index "issues", ["author_id"], name: "index_issues_on_author_id", using: :btree @@ -2013,6 +2014,7 @@ ActiveRecord::Schema.define(version: 20180216121030) do add_foreign_key "issues", "milestones", name: "fk_96b1dd429c", on_delete: :nullify add_foreign_key "issues", "projects", name: "fk_899c8f3231", on_delete: :cascade add_foreign_key "issues", "users", column: "author_id", name: "fk_05f1e72feb", on_delete: :nullify + add_foreign_key "issues", "users", column: "closed_by_id", name: "fk_c63cbf6c25", on_delete: :nullify add_foreign_key "issues", "users", column: "updated_by_id", name: "fk_ffed080f01", on_delete: :nullify add_foreign_key "label_priorities", "labels", on_delete: :cascade add_foreign_key "label_priorities", "projects", on_delete: :cascade -- cgit v1.2.1 From 93bf4d1f264b4609137e4afd9d0728bc47a1964f Mon Sep 17 00:00:00 2001 From: haseeb Date: Tue, 27 Feb 2018 22:14:47 +0530 Subject: schema version change --- db/schema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'db') diff --git a/db/schema.rb b/db/schema.rb index cb4362a5306..ae3585d1030 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180216121030) do +ActiveRecord::Schema.define(version: 20180209165249) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" -- cgit v1.2.1 From fdc4aeb26982c94d876024a3d56b56ba6358b62e Mon Sep 17 00:00:00 2001 From: haseeb Date: Wed, 28 Feb 2018 19:40:05 +0530 Subject: schema version change --- db/schema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'db') diff --git a/db/schema.rb b/db/schema.rb index ae3585d1030..cb4362a5306 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180209165249) do +ActiveRecord::Schema.define(version: 20180216121030) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" -- cgit v1.2.1