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>2020-08-11 00:09:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-11 00:09:44 +0300
commitfba0e44e0898f20f7514c186b20a1935355e7303 (patch)
tree11363dfcfb4292ba916fa277c0ee4e92f428e67f /db
parent350fd8b878fe930b83c52ccae82f861cc499776a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200731085019_create_experiment.rb25
-rw-r--r--db/migrate/20200731090553_create_experiment_user.rb21
-rw-r--r--db/migrate/20200731201408_add_foreign_key_to_experiment_on_experiment_users.rb20
-rw-r--r--db/migrate/20200731201834_add_foreign_key_to_user_on_experiment_users.rb20
-rw-r--r--db/migrate/20200810152043_add_expire_at_to_ci_pipeline_artifact.rb9
-rw-r--r--db/schema_migrations/202007310850191
-rw-r--r--db/schema_migrations/202007310905531
-rw-r--r--db/schema_migrations/202007312014081
-rw-r--r--db/schema_migrations/202007312018341
-rw-r--r--db/schema_migrations/202008101520431
-rw-r--r--db/structure.sql56
11 files changed, 156 insertions, 0 deletions
diff --git a/db/migrate/20200731085019_create_experiment.rb b/db/migrate/20200731085019_create_experiment.rb
new file mode 100644
index 00000000000..cd326e0958f
--- /dev/null
+++ b/db/migrate/20200731085019_create_experiment.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class CreateExperiment < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ unless table_exists?(:experiments)
+ create_table :experiments do |t|
+ t.text :name, null: false
+
+ t.index :name, unique: true
+ end
+ end
+
+ add_text_limit :experiments, :name, 255
+ end
+
+ def down
+ drop_table :experiments
+ end
+end
diff --git a/db/migrate/20200731090553_create_experiment_user.rb b/db/migrate/20200731090553_create_experiment_user.rb
new file mode 100644
index 00000000000..9080429dfd3
--- /dev/null
+++ b/db/migrate/20200731090553_create_experiment_user.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class CreateExperimentUser < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ create_table :experiment_users do |t|
+ t.bigint :experiment_id, null: false
+ t.bigint :user_id, null: false
+ t.integer :group_type, limit: 2, null: false, default: 0
+ t.timestamps_with_timezone null: false
+ end
+
+ add_index :experiment_users, :experiment_id
+ add_index :experiment_users, :user_id
+ end
+
+ def down
+ drop_table :experiment_users
+ end
+end
diff --git a/db/migrate/20200731201408_add_foreign_key_to_experiment_on_experiment_users.rb b/db/migrate/20200731201408_add_foreign_key_to_experiment_on_experiment_users.rb
new file mode 100644
index 00000000000..3961803bf52
--- /dev/null
+++ b/db/migrate/20200731201408_add_foreign_key_to_experiment_on_experiment_users.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToExperimentOnExperimentUsers < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ # There is no need to use add_concurrent_foreign_key since it's an empty table
+ add_foreign_key :experiment_users, :experiments, column: :experiment_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :experiment_users, column: :experiment_id
+ end
+ end
+end
diff --git a/db/migrate/20200731201834_add_foreign_key_to_user_on_experiment_users.rb b/db/migrate/20200731201834_add_foreign_key_to_user_on_experiment_users.rb
new file mode 100644
index 00000000000..42c337fecff
--- /dev/null
+++ b/db/migrate/20200731201834_add_foreign_key_to_user_on_experiment_users.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToUserOnExperimentUsers < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ # There is no need to use add_concurrent_foreign_key since it's an empty table
+ add_foreign_key :experiment_users, :users, column: :user_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :experiment_users, column: :user_id
+ end
+ end
+end
diff --git a/db/migrate/20200810152043_add_expire_at_to_ci_pipeline_artifact.rb b/db/migrate/20200810152043_add_expire_at_to_ci_pipeline_artifact.rb
new file mode 100644
index 00000000000..1aaa0f36f16
--- /dev/null
+++ b/db/migrate/20200810152043_add_expire_at_to_ci_pipeline_artifact.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddExpireAtToCiPipelineArtifact < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :ci_pipeline_artifacts, :expire_at, :datetime_with_timezone
+ end
+end
diff --git a/db/schema_migrations/20200731085019 b/db/schema_migrations/20200731085019
new file mode 100644
index 00000000000..55e35ff8f4a
--- /dev/null
+++ b/db/schema_migrations/20200731085019
@@ -0,0 +1 @@
+aeeef4762f7ab7c7eefc28995ba198825455a43db38c1ff2aefad8c3c76b5fba \ No newline at end of file
diff --git a/db/schema_migrations/20200731090553 b/db/schema_migrations/20200731090553
new file mode 100644
index 00000000000..d991f11eb02
--- /dev/null
+++ b/db/schema_migrations/20200731090553
@@ -0,0 +1 @@
+c5775e8150285927b74c2fbf6098d03920e7bea52c3b94ad372fec288835110c \ No newline at end of file
diff --git a/db/schema_migrations/20200731201408 b/db/schema_migrations/20200731201408
new file mode 100644
index 00000000000..1f457761c90
--- /dev/null
+++ b/db/schema_migrations/20200731201408
@@ -0,0 +1 @@
+02f3561a5b8fa79c58dccc23ebaecf2c1b8371c86bb360156456bd11e84d13a2 \ No newline at end of file
diff --git a/db/schema_migrations/20200731201834 b/db/schema_migrations/20200731201834
new file mode 100644
index 00000000000..4c4630e54ad
--- /dev/null
+++ b/db/schema_migrations/20200731201834
@@ -0,0 +1 @@
+26aa28efa15ebd223feb879d5cb684a53a92bc71e483e8348d0cd9f1ad10e7ae \ No newline at end of file
diff --git a/db/schema_migrations/20200810152043 b/db/schema_migrations/20200810152043
new file mode 100644
index 00000000000..2b20ae9fdf1
--- /dev/null
+++ b/db/schema_migrations/20200810152043
@@ -0,0 +1 @@
+d459b160ae86f035509e382c12b76fdd441f58e0838a983471326a750a48e9fd \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 1afbe8e8417..7fd390b6ea4 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -10058,6 +10058,7 @@ CREATE TABLE public.ci_pipeline_artifacts (
file_type smallint NOT NULL,
file_format smallint NOT NULL,
file text,
+ expire_at timestamp with time zone,
CONSTRAINT check_191b5850ec CHECK ((char_length(file) <= 255))
);
@@ -11557,6 +11558,39 @@ CREATE SEQUENCE public.evidences_id_seq
ALTER SEQUENCE public.evidences_id_seq OWNED BY public.evidences.id;
+CREATE TABLE public.experiment_users (
+ id bigint NOT NULL,
+ experiment_id bigint NOT NULL,
+ user_id bigint NOT NULL,
+ group_type smallint DEFAULT 0 NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL
+);
+
+CREATE SEQUENCE public.experiment_users_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.experiment_users_id_seq OWNED BY public.experiment_users.id;
+
+CREATE TABLE public.experiments (
+ id bigint NOT NULL,
+ name text NOT NULL,
+ CONSTRAINT check_e2dda25ed0 CHECK ((char_length(name) <= 255))
+);
+
+CREATE SEQUENCE public.experiments_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.experiments_id_seq OWNED BY public.experiments.id;
+
CREATE TABLE public.external_pull_requests (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -16874,6 +16908,10 @@ ALTER TABLE ONLY public.events ALTER COLUMN id SET DEFAULT nextval('public.event
ALTER TABLE ONLY public.evidences ALTER COLUMN id SET DEFAULT nextval('public.evidences_id_seq'::regclass);
+ALTER TABLE ONLY public.experiment_users ALTER COLUMN id SET DEFAULT nextval('public.experiment_users_id_seq'::regclass);
+
+ALTER TABLE ONLY public.experiments ALTER COLUMN id SET DEFAULT nextval('public.experiments_id_seq'::regclass);
+
ALTER TABLE ONLY public.external_pull_requests ALTER COLUMN id SET DEFAULT nextval('public.external_pull_requests_id_seq'::regclass);
ALTER TABLE ONLY public.feature_gates ALTER COLUMN id SET DEFAULT nextval('public.feature_gates_id_seq'::regclass);
@@ -17892,6 +17930,12 @@ ALTER TABLE ONLY public.events
ALTER TABLE ONLY public.evidences
ADD CONSTRAINT evidences_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY public.experiment_users
+ ADD CONSTRAINT experiment_users_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.experiments
+ ADD CONSTRAINT experiments_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY public.external_pull_requests
ADD CONSTRAINT external_pull_requests_pkey PRIMARY KEY (id);
@@ -19534,6 +19578,12 @@ CREATE UNIQUE INDEX index_events_on_target_type_and_target_id_and_fingerprint ON
CREATE INDEX index_evidences_on_release_id ON public.evidences USING btree (release_id);
+CREATE INDEX index_experiment_users_on_experiment_id ON public.experiment_users USING btree (experiment_id);
+
+CREATE INDEX index_experiment_users_on_user_id ON public.experiment_users USING btree (user_id);
+
+CREATE UNIQUE INDEX index_experiments_on_name ON public.experiments USING btree (name);
+
CREATE INDEX index_expired_and_not_notified_personal_access_tokens ON public.personal_access_tokens USING btree (id, expires_at) WHERE ((impersonation = false) AND (revoked = false) AND (expire_notification_delivered = false));
CREATE UNIQUE INDEX index_external_pull_requests_on_project_and_branches ON public.external_pull_requests USING btree (project_id, source_branch, target_branch);
@@ -22249,6 +22299,9 @@ ALTER TABLE ONLY public.terraform_states
ALTER TABLE ONLY public.group_deploy_keys
ADD CONSTRAINT fk_rails_5682fc07f8 FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE RESTRICT;
+ALTER TABLE ONLY public.experiment_users
+ ADD CONSTRAINT fk_rails_56d4708b4a FOREIGN KEY (experiment_id) REFERENCES public.experiments(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY public.issue_user_mentions
ADD CONSTRAINT fk_rails_57581fda73 FOREIGN KEY (issue_id) REFERENCES public.issues(id) ON DELETE CASCADE;
@@ -23011,6 +23064,9 @@ ALTER TABLE ONLY public.ci_job_variables
ALTER TABLE ONLY public.packages_nuget_metadata
ADD CONSTRAINT fk_rails_fc0c19f5b4 FOREIGN KEY (package_id) REFERENCES public.packages_packages(id) ON DELETE CASCADE;
+ALTER TABLE ONLY public.experiment_users
+ ADD CONSTRAINT fk_rails_fd805f771a FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY public.cluster_groups
ADD CONSTRAINT fk_rails_fdb8648a96 FOREIGN KEY (cluster_id) REFERENCES public.clusters(id) ON DELETE CASCADE;