Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20180517082340_add_not_null_constraints_to_project_authorizations.rb')
-rw-r--r--db/migrate/20180517082340_add_not_null_constraints_to_project_authorizations.rb22
1 files changed, 4 insertions, 18 deletions
diff --git a/db/migrate/20180517082340_add_not_null_constraints_to_project_authorizations.rb b/db/migrate/20180517082340_add_not_null_constraints_to_project_authorizations.rb
index 36f4770ff32..859e341d04b 100644
--- a/db/migrate/20180517082340_add_not_null_constraints_to_project_authorizations.rb
+++ b/db/migrate/20180517082340_add_not_null_constraints_to_project_authorizations.rb
@@ -5,34 +5,20 @@ class AddNotNullConstraintsToProjectAuthorizations < ActiveRecord::Migration[4.2
DOWNTIME = false
def up
- if Gitlab::Database.postgresql?
- # One-pass version for PostgreSQL
- execute <<~SQL
+ execute <<~SQL
ALTER TABLE project_authorizations
ALTER COLUMN user_id SET NOT NULL,
ALTER COLUMN project_id SET NOT NULL,
ALTER COLUMN access_level SET NOT NULL
- SQL
- else
- change_column_null :project_authorizations, :user_id, false
- change_column_null :project_authorizations, :project_id, false
- change_column_null :project_authorizations, :access_level, false
- end
+ SQL
end
def down
- if Gitlab::Database.postgresql?
- # One-pass version for PostgreSQL
- execute <<~SQL
+ execute <<~SQL
ALTER TABLE project_authorizations
ALTER COLUMN user_id DROP NOT NULL,
ALTER COLUMN project_id DROP NOT NULL,
ALTER COLUMN access_level DROP NOT NULL
- SQL
- else
- change_column_null :project_authorizations, :user_id, true
- change_column_null :project_authorizations, :project_id, true
- change_column_null :project_authorizations, :access_level, true
- end
+ SQL
end
end