From de51251546d8aae5d4ba948eada490d41aedd9ef Mon Sep 17 00:00:00 2001 From: hustewart Date: Mon, 27 Oct 2025 13:47:39 -0400 Subject: [PATCH] Drop snippet_repositories.shard_id NOT NULL This is part of the cells work to shard this table by organization_id. It excludes `snippet_repositories.shard_id` from the schema test. This will be set to a loose foreign key in this merge request: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/209036 Changelog: added --- ...ll_constraint_from_snippet_repositories_shard.rb | 13 +++++++++++++ db/schema_migrations/20251119184052 | 1 + db/structure.sql | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20251119184052_remove_not_null_constraint_from_snippet_repositories_shard.rb create mode 100644 db/schema_migrations/20251119184052 diff --git a/db/migrate/20251119184052_remove_not_null_constraint_from_snippet_repositories_shard.rb b/db/migrate/20251119184052_remove_not_null_constraint_from_snippet_repositories_shard.rb new file mode 100644 index 00000000000000..fab1f1da76eae2 --- /dev/null +++ b/db/migrate/20251119184052_remove_not_null_constraint_from_snippet_repositories_shard.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class RemoveNotNullConstraintFromSnippetRepositoriesShard < Gitlab::Database::Migration[2.3] + milestone '18.7' + + def up + change_column_null :snippet_repositories, :shard_id, true + end + + def down + # No-op + end +end diff --git a/db/schema_migrations/20251119184052 b/db/schema_migrations/20251119184052 new file mode 100644 index 00000000000000..fd293f0ed3fb88 --- /dev/null +++ b/db/schema_migrations/20251119184052 @@ -0,0 +1 @@ +6bbaa0b4a7030ac27ebeb1784ef1f95acda3b779617274bef83d081bacc5b84b \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index ed73e7ab895540..4b241580d49747 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -23075,7 +23075,7 @@ ALTER SEQUENCE personal_access_tokens_id_seq OWNED BY personal_access_tokens.id; CREATE TABLE snippet_repositories ( snippet_id bigint NOT NULL, - shard_id bigint NOT NULL, + shard_id bigint, disk_path character varying(80) NOT NULL, verification_retry_count smallint, verification_retry_at timestamp with time zone, -- GitLab