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
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-03-01 00:14:01 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-03-01 00:14:01 +0300
commit9712632edfa3d773751dd051ab45122b0e78761a (patch)
tree1cdc7d56dbaeb3770745e509aebd21d5d23b2fda /db
parente804afddbf68cc6f306bc4aa9aaea88be774ebe4 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20220222192524_create_not_null_constraint_releases_tag.rb13
-rw-r--r--db/post_migrate/20220222192525_remove_null_releases.rb24
-rw-r--r--db/schema_migrations/202202221925241
-rw-r--r--db/schema_migrations/202202221925251
-rw-r--r--db/structure.sql3
5 files changed, 42 insertions, 0 deletions
diff --git a/db/post_migrate/20220222192524_create_not_null_constraint_releases_tag.rb b/db/post_migrate/20220222192524_create_not_null_constraint_releases_tag.rb
new file mode 100644
index 00000000000..2bb5ba18743
--- /dev/null
+++ b/db/post_migrate/20220222192524_create_not_null_constraint_releases_tag.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class CreateNotNullConstraintReleasesTag < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ add_not_null_constraint :releases, :tag, constraint_name: 'releases_not_null_tag', validate: false
+ end
+
+ def down
+ remove_not_null_constraint :releases, :tag, constraint_name: 'releases_not_null_tag'
+ end
+end
diff --git a/db/post_migrate/20220222192525_remove_null_releases.rb b/db/post_migrate/20220222192525_remove_null_releases.rb
new file mode 100644
index 00000000000..4efd5393122
--- /dev/null
+++ b/db/post_migrate/20220222192525_remove_null_releases.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class RemoveNullReleases < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ class Release < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'releases'
+ end
+
+ def up
+ Release.all.each_batch(of: 25000) do |rel|
+ rel.where(tag: nil).delete_all
+ end
+ end
+
+ def down
+ # no-op
+ #
+ # releases with the same tag within a project have been removed
+ # and therefore the duplicate release data is no longer available
+ end
+end
diff --git a/db/schema_migrations/20220222192524 b/db/schema_migrations/20220222192524
new file mode 100644
index 00000000000..c49e45f0d61
--- /dev/null
+++ b/db/schema_migrations/20220222192524
@@ -0,0 +1 @@
+b876119bb369a9831736cddf5326b72a74003ec2e17fe863654cb69497fcf236 \ No newline at end of file
diff --git a/db/schema_migrations/20220222192525 b/db/schema_migrations/20220222192525
new file mode 100644
index 00000000000..6eeec13bbb5
--- /dev/null
+++ b/db/schema_migrations/20220222192525
@@ -0,0 +1 @@
+f512ea4c4a2625c647c3d05765152fee963b56962b674f839180fd77c194ccb0 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 613fe897401..ab87ddf896c 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -25064,6 +25064,9 @@ ALTER TABLE ONLY related_epic_links
ALTER TABLE ONLY release_links
ADD CONSTRAINT release_links_pkey PRIMARY KEY (id);
+ALTER TABLE releases
+ ADD CONSTRAINT releases_not_null_tag CHECK ((tag IS NOT NULL)) NOT VALID;
+
ALTER TABLE ONLY releases
ADD CONSTRAINT releases_pkey PRIMARY KEY (id);