summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2016-06-16 09:26:39 +0000
committerValery Sizov <valery@gitlab.com>2016-06-16 09:26:39 +0000
commit1d20eefdcf5713505fe7829113a6a50c3ec6bea1 (patch)
treef042f76ee85370255a818cc59b644687aa82e648
parent1b43f51ad057dfb04994e6600e35b8e390843897 (diff)
parentdda94e04062623702f03d427b17931a7c93f64c5 (diff)
downloadgitlab-ce-1d20eefdcf5713505fe7829113a6a50c3ec6bea1.tar.gz
Merge branch 'fix-environments-db' into 'master'
Make project_id nullable ## What does this MR do? Fixes the broken migration which is not in sync with `db/schema.rb`. It's to solve https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/469. See merge request !4701
-rw-r--r--db/migrate/20160616084004_change_project_of_environment.rb21
-rw-r--r--db/schema.rb2
2 files changed, 22 insertions, 1 deletions
diff --git a/db/migrate/20160616084004_change_project_of_environment.rb b/db/migrate/20160616084004_change_project_of_environment.rb
new file mode 100644
index 00000000000..cc1daf9b621
--- /dev/null
+++ b/db/migrate/20160616084004_change_project_of_environment.rb
@@ -0,0 +1,21 @@
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class ChangeProjectOfEnvironment < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ # When using the methods "add_concurrent_index" or "add_column_with_default"
+ # you must disable the use of transactions as these methods can not run in an
+ # existing transaction. When using "add_concurrent_index" make sure that this
+ # method is the _only_ method called in the migration, any other changes
+ # should go in a separate migration. This ensures that upon failure _only_ the
+ # index creation fails and can be retried or reverted easily.
+ #
+ # To disable transactions uncomment the following line and remove these
+ # comments:
+ # disable_ddl_transaction!
+
+ def change
+ change_column_null :environments, :project_id, true
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 6a3be7297e3..d6a542a89fd 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: 20160615142710) do
+ActiveRecord::Schema.define(version: 20160616084004) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"