summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-28 15:08:49 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-28 15:08:49 +0000
commit77d49e6a73b3a1e142ec865d05dc3dd9a708ab6a (patch)
tree8b208f19500d18308b47807d6d2f58262752afaa /db
parent24e7d185395af41290e5622cad160b7efe230145 (diff)
downloadgitlab-ce-77d49e6a73b3a1e142ec865d05dc3dd9a708ab6a.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200908212414_add_feature_flag_events_to_web_hooks.rb9
-rw-r--r--db/migrate/20201012073022_remove_not_null_constraint_on_framework.rb33
-rw-r--r--db/schema_migrations/202009082124141
-rw-r--r--db/schema_migrations/202010120730221
-rw-r--r--db/structure.sql5
5 files changed, 47 insertions, 2 deletions
diff --git a/db/migrate/20200908212414_add_feature_flag_events_to_web_hooks.rb b/db/migrate/20200908212414_add_feature_flag_events_to_web_hooks.rb
new file mode 100644
index 00000000000..40e2b37b390
--- /dev/null
+++ b/db/migrate/20200908212414_add_feature_flag_events_to_web_hooks.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddFeatureFlagEventsToWebHooks < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :web_hooks, :feature_flag_events, :boolean, null: false, default: false
+ end
+end
diff --git a/db/migrate/20201012073022_remove_not_null_constraint_on_framework.rb b/db/migrate/20201012073022_remove_not_null_constraint_on_framework.rb
new file mode 100644
index 00000000000..b8cc8984575
--- /dev/null
+++ b/db/migrate/20201012073022_remove_not_null_constraint_on_framework.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+class RemoveNotNullConstraintOnFramework < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ GDPR_FRAMEWORK_ID = 1
+
+ disable_ddl_transaction!
+
+ class TmpComplianceProjectFrameworkSetting < ActiveRecord::Base
+ self.table_name = 'project_compliance_framework_settings'
+ self.primary_key = :project_id
+
+ include EachBatch
+ end
+
+ def up
+ change_column_null :project_compliance_framework_settings, :framework, true
+ end
+
+ def down
+ # Custom frameworks cannot be rolled back easily since we don't have enum for them.
+ # To make the database consistent, we mark them as GDPR framework.
+ # Note: framework customization will be implemented in the next 1-3 releases so data
+ # corruption due to the rollback is unlikely.
+ TmpComplianceProjectFrameworkSetting.each_batch(of: 100) do |query|
+ query.where(framework: nil).update_all(framework: GDPR_FRAMEWORK_ID)
+ end
+
+ change_column_null :project_compliance_framework_settings, :framework, false
+ end
+end
diff --git a/db/schema_migrations/20200908212414 b/db/schema_migrations/20200908212414
new file mode 100644
index 00000000000..208f9affc91
--- /dev/null
+++ b/db/schema_migrations/20200908212414
@@ -0,0 +1 @@
+a9605126178d887bbf526a4a33b7060b072eff7a8d6712e3552099f7e615f88b \ No newline at end of file
diff --git a/db/schema_migrations/20201012073022 b/db/schema_migrations/20201012073022
new file mode 100644
index 00000000000..b7ce136a7e3
--- /dev/null
+++ b/db/schema_migrations/20201012073022
@@ -0,0 +1 @@
+234711b96d3869fe826dfd71ae29e0f75e50302bc29a4e60f436ec76b4be3efb \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index c117864ff81..7c4f5088069 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -14837,7 +14837,7 @@ ALTER SEQUENCE project_ci_cd_settings_id_seq OWNED BY project_ci_cd_settings.id;
CREATE TABLE project_compliance_framework_settings (
project_id bigint NOT NULL,
- framework smallint NOT NULL,
+ framework smallint,
framework_id bigint,
CONSTRAINT check_d348de9e2d CHECK ((framework_id IS NOT NULL))
);
@@ -17295,7 +17295,8 @@ CREATE TABLE web_hooks (
encrypted_token_iv character varying,
encrypted_url character varying,
encrypted_url_iv character varying,
- deployment_events boolean DEFAULT false NOT NULL
+ deployment_events boolean DEFAULT false NOT NULL,
+ feature_flag_events boolean DEFAULT false NOT NULL
);
CREATE SEQUENCE web_hooks_id_seq