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:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20230215131026_add_has_failures_column_to_bulk_imports.rb7
-rw-r--r--db/migrate/20230216152912_add_has_failures_column_to_bulk_import_entities.rb7
-rw-r--r--db/post_migrate/20230131184319_update_billable_users_index_for_service_accounts.rb27
-rw-r--r--db/schema_migrations/202301311843191
-rw-r--r--db/schema_migrations/202302151310261
-rw-r--r--db/schema_migrations/202302161529121
-rw-r--r--db/structure.sql4
7 files changed, 47 insertions, 1 deletions
diff --git a/db/migrate/20230215131026_add_has_failures_column_to_bulk_imports.rb b/db/migrate/20230215131026_add_has_failures_column_to_bulk_imports.rb
new file mode 100644
index 00000000000..52517244f3e
--- /dev/null
+++ b/db/migrate/20230215131026_add_has_failures_column_to_bulk_imports.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddHasFailuresColumnToBulkImports < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :bulk_imports, :has_failures, :boolean, default: false
+ end
+end
diff --git a/db/migrate/20230216152912_add_has_failures_column_to_bulk_import_entities.rb b/db/migrate/20230216152912_add_has_failures_column_to_bulk_import_entities.rb
new file mode 100644
index 00000000000..4c48acd9dce
--- /dev/null
+++ b/db/migrate/20230216152912_add_has_failures_column_to_bulk_import_entities.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddHasFailuresColumnToBulkImportEntities < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :bulk_import_entities, :has_failures, :boolean, default: false
+ end
+end
diff --git a/db/post_migrate/20230131184319_update_billable_users_index_for_service_accounts.rb b/db/post_migrate/20230131184319_update_billable_users_index_for_service_accounts.rb
new file mode 100644
index 00000000000..e86a2476156
--- /dev/null
+++ b/db/post_migrate/20230131184319_update_billable_users_index_for_service_accounts.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class UpdateBillableUsersIndexForServiceAccounts < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ OLD_INDEX = 'index_users_for_billable_users'
+ NEW_INDEX = 'index_users_for_active_billable_users'
+
+ OLD_INDEX_CONDITION = <<~QUERY
+ ((state)::text = 'active'::text) AND ((user_type IS NULL)
+ OR (user_type = ANY (ARRAY[6, 4]))) AND
+ ((user_type IS NULL) OR (user_type = ANY (ARRAY[4, 5])))
+ QUERY
+ NEW_INDEX_CONDITION = <<~QUERY
+ state = 'active' AND (user_type IS NULL OR user_type IN (6, 4, 13)) AND (user_type IS NULL OR user_type IN (4, 5))
+ QUERY
+
+ def up
+ add_concurrent_index(:users, :id, where: NEW_INDEX_CONDITION, name: NEW_INDEX)
+ remove_concurrent_index_by_name(:users, OLD_INDEX)
+ end
+
+ def down
+ add_concurrent_index(:users, :id, where: OLD_INDEX_CONDITION, name: OLD_INDEX)
+ remove_concurrent_index_by_name(:users, NEW_INDEX)
+ end
+end
diff --git a/db/schema_migrations/20230131184319 b/db/schema_migrations/20230131184319
new file mode 100644
index 00000000000..3028f92b316
--- /dev/null
+++ b/db/schema_migrations/20230131184319
@@ -0,0 +1 @@
+06a6005ecc7de9b6db9912b246aa27c30b308f47f23f1258043b7a7c636962b6 \ No newline at end of file
diff --git a/db/schema_migrations/20230215131026 b/db/schema_migrations/20230215131026
new file mode 100644
index 00000000000..3bec8e04f4f
--- /dev/null
+++ b/db/schema_migrations/20230215131026
@@ -0,0 +1 @@
+095cc516f50dcb11e01ccda962a9776fddcec439520cef795f6c8715b5941aba \ No newline at end of file
diff --git a/db/schema_migrations/20230216152912 b/db/schema_migrations/20230216152912
new file mode 100644
index 00000000000..e9f1dfb9db3
--- /dev/null
+++ b/db/schema_migrations/20230216152912
@@ -0,0 +1 @@
+66b74e0442763b2a05ec411344d8ca97b7d3d2e8cef9d2e04baba246b1c025a2 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index e1d3e46161f..b4b0b2f83b0 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -12662,6 +12662,7 @@ CREATE TABLE bulk_import_entities (
updated_at timestamp with time zone NOT NULL,
source_xid integer,
migrate_projects boolean DEFAULT true NOT NULL,
+ has_failures boolean DEFAULT false,
CONSTRAINT check_13f279f7da CHECK ((char_length(source_full_path) <= 255)),
CONSTRAINT check_715d725ea2 CHECK ((char_length(destination_name) <= 255)),
CONSTRAINT check_796a4d9cc6 CHECK ((char_length(jid) <= 255)),
@@ -12778,6 +12779,7 @@ CREATE TABLE bulk_imports (
updated_at timestamp with time zone NOT NULL,
source_version text,
source_enterprise boolean DEFAULT true NOT NULL,
+ has_failures boolean DEFAULT false,
CONSTRAINT check_ea4e58775a CHECK ((char_length(source_version) <= 63))
);
@@ -31981,7 +31983,7 @@ CREATE INDEX index_user_statuses_on_user_id ON user_statuses USING btree (user_i
CREATE UNIQUE INDEX index_user_synced_attributes_metadata_on_user_id ON user_synced_attributes_metadata USING btree (user_id);
-CREATE INDEX index_users_for_billable_users ON users USING btree (id) WHERE (((state)::text = 'active'::text) AND ((user_type IS NULL) OR (user_type = ANY (ARRAY[6, 4]))) AND ((user_type IS NULL) OR (user_type = ANY (ARRAY[4, 5]))));
+CREATE INDEX index_users_for_active_billable_users ON users USING btree (id) WHERE (((state)::text = 'active'::text) AND ((user_type IS NULL) OR (user_type = ANY (ARRAY[6, 4, 13]))) AND ((user_type IS NULL) OR (user_type = ANY (ARRAY[4, 5]))));
CREATE INDEX index_users_on_accepted_term_id ON users USING btree (accepted_term_id);