Commit 3b8daa00 authored by Mike Kozono's avatar Mike Kozono

Validate not null file_store

And remove an index which was added only to facilitate populating NULL
values.
parent c0dc8634
---
title: Validate not null file_store field on packages_package_files to maintain data
integrity
merge_request: 42400
author:
type: added
# frozen_string_literal: true
class ValidateNotNullFileStoreOnPackageFiles < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
# Remove index which was only added to fill file_store
INDEX_NAME = 'index_packages_package_files_file_store_is_null'
DOWNTIME = false
disable_ddl_transaction!
def up
validate_not_null_constraint :packages_package_files, :file_store
remove_concurrent_index_by_name :packages_package_files, INDEX_NAME
end
def down
add_concurrent_index :packages_package_files, :id, where: 'file_store IS NULL', name: INDEX_NAME
end
end
d8ddec6b234d59b3b85705dfa7b724d3be4974bfa57fae70aa5c2dbdd2e73cfa
\ No newline at end of file
......@@ -14123,7 +14123,8 @@ CREATE TABLE packages_package_files (
verified_at timestamp with time zone,
verification_failure character varying(255),
verification_retry_count integer,
verification_checksum bytea
verification_checksum bytea,
CONSTRAINT check_4c5e6bb0b3 CHECK ((file_store IS NOT NULL))
);
CREATE SEQUENCE packages_package_files_id_seq
......@@ -18083,9 +18084,6 @@ ALTER TABLE design_management_designs
ALTER TABLE vulnerability_scanners
ADD CONSTRAINT check_37608c9db5 CHECK ((char_length(vendor) <= 255)) NOT VALID;
ALTER TABLE packages_package_files
ADD CONSTRAINT check_4c5e6bb0b3 CHECK ((file_store IS NOT NULL)) NOT VALID;
ALTER TABLE group_import_states
ADD CONSTRAINT check_cda75c7c3f CHECK ((user_id IS NOT NULL)) NOT VALID;
......@@ -20683,8 +20681,6 @@ CREATE INDEX index_packages_nuget_dl_metadata_on_dependency_link_id ON packages_
CREATE UNIQUE INDEX index_packages_on_project_id_name_version_unique_when_generic ON packages_packages USING btree (project_id, name, version) WHERE (package_type = 7);
CREATE INDEX index_packages_package_files_file_store_is_null ON packages_package_files USING btree (id) WHERE (file_store IS NULL);
CREATE INDEX index_packages_package_files_on_file_store ON packages_package_files USING btree (file_store);
CREATE INDEX index_packages_package_files_on_package_id_and_file_name ON packages_package_files USING btree (package_id, file_name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment