diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-09 06:09:18 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-09 06:09:18 +0300 |
commit | 9c8d620e48c59fe3d10f9c4b50f91124d7c09182 (patch) | |
tree | c629ebcedd29c2ca756af2367218f6723ac3d58d /db | |
parent | 1c0289261b8d67e983b5d3ed1ef23fd800deab98 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20201204111400_create_packages_debian_project_component_files.rb | 41 | ||||
-rw-r--r-- | db/migrate/20201204111500_create_packages_debian_group_component_files.rb | 41 | ||||
-rw-r--r-- | db/schema_migrations/20201204111400 | 1 | ||||
-rw-r--r-- | db/schema_migrations/20201204111500 | 1 | ||||
-rw-r--r-- | db/structure.sql | 80 |
5 files changed, 164 insertions, 0 deletions
diff --git a/db/migrate/20201204111400_create_packages_debian_project_component_files.rb b/db/migrate/20201204111400_create_packages_debian_project_component_files.rb new file mode 100644 index 00000000000..74ee1e9c4cf --- /dev/null +++ b/db/migrate/20201204111400_create_packages_debian_project_component_files.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +class CreatePackagesDebianProjectComponentFiles < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + INDEX_ARCHITECTURE = 'idx_packages_debian_project_component_files_on_architecture_id' + + disable_ddl_transaction! + + def up + with_lock_retries do + unless table_exists?(:packages_debian_project_component_files) + create_table :packages_debian_project_component_files do |t| + t.timestamps_with_timezone + t.references :component, + foreign_key: { to_table: :packages_debian_project_components, on_delete: :restrict }, + null: false, + index: true + t.references :architecture, + foreign_key: { to_table: :packages_debian_project_architectures, on_delete: :restrict }, + index: { name: INDEX_ARCHITECTURE } + t.integer :size, null: false + t.integer :file_type, limit: 2, null: false + t.integer :compression_type, limit: 2 + t.integer :file_store, limit: 2, default: 1, null: false + t.text :file, null: false + t.binary :file_md5, null: false + t.binary :file_sha256, null: false + end + end + end + + add_text_limit :packages_debian_project_component_files, :file, 255 + end + + def down + drop_table :packages_debian_project_component_files + end +end diff --git a/db/migrate/20201204111500_create_packages_debian_group_component_files.rb b/db/migrate/20201204111500_create_packages_debian_group_component_files.rb new file mode 100644 index 00000000000..2592d5b108a --- /dev/null +++ b/db/migrate/20201204111500_create_packages_debian_group_component_files.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +class CreatePackagesDebianGroupComponentFiles < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + INDEX_ARCHITECTURE = 'idx_packages_debian_group_component_files_on_architecture_id' + + disable_ddl_transaction! + + def up + with_lock_retries do + unless table_exists?(:packages_debian_group_component_files) + create_table :packages_debian_group_component_files do |t| + t.timestamps_with_timezone + t.references :component, + foreign_key: { to_table: :packages_debian_group_components, on_delete: :restrict }, + null: false, + index: true + t.references :architecture, + foreign_key: { to_table: :packages_debian_group_architectures, on_delete: :restrict }, + index: { name: INDEX_ARCHITECTURE } + t.integer :size, null: false + t.integer :file_type, limit: 2, null: false + t.integer :compression_type, limit: 2 + t.integer :file_store, limit: 2, default: 1, null: false + t.text :file, null: false + t.binary :file_md5, null: false + t.binary :file_sha256, null: false + end + end + end + + add_text_limit :packages_debian_group_component_files, :file, 255 + end + + def down + drop_table :packages_debian_group_component_files + end +end diff --git a/db/schema_migrations/20201204111400 b/db/schema_migrations/20201204111400 new file mode 100644 index 00000000000..54fcc022f10 --- /dev/null +++ b/db/schema_migrations/20201204111400 @@ -0,0 +1 @@ +6fcaa4184ae69fabd6f2668cad19c38a8ae7c187053d60cdf4fcbdbc0443aa42
\ No newline at end of file diff --git a/db/schema_migrations/20201204111500 b/db/schema_migrations/20201204111500 new file mode 100644 index 00000000000..d482fb6d31a --- /dev/null +++ b/db/schema_migrations/20201204111500 @@ -0,0 +1 @@ +3f422a916b50cafd46b4a7486b6c3cc0a9992831a7dbc40c51323c835d845a0a
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 5211776e17f..7400b023fd5 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -14894,6 +14894,31 @@ CREATE SEQUENCE packages_debian_group_architectures_id_seq ALTER SEQUENCE packages_debian_group_architectures_id_seq OWNED BY packages_debian_group_architectures.id; +CREATE TABLE packages_debian_group_component_files ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + component_id bigint NOT NULL, + architecture_id bigint, + size integer NOT NULL, + file_type smallint NOT NULL, + compression_type smallint, + file_store smallint DEFAULT 1 NOT NULL, + file text NOT NULL, + file_md5 bytea NOT NULL, + file_sha256 bytea NOT NULL, + CONSTRAINT check_839e1685bc CHECK ((char_length(file) <= 255)) +); + +CREATE SEQUENCE packages_debian_group_component_files_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE packages_debian_group_component_files_id_seq OWNED BY packages_debian_group_component_files.id; + CREATE TABLE packages_debian_group_components ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -14971,6 +14996,31 @@ CREATE SEQUENCE packages_debian_project_architectures_id_seq ALTER SEQUENCE packages_debian_project_architectures_id_seq OWNED BY packages_debian_project_architectures.id; +CREATE TABLE packages_debian_project_component_files ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + component_id bigint NOT NULL, + architecture_id bigint, + size integer NOT NULL, + file_type smallint NOT NULL, + compression_type smallint, + file_store smallint DEFAULT 1 NOT NULL, + file text NOT NULL, + file_md5 bytea NOT NULL, + file_sha256 bytea NOT NULL, + CONSTRAINT check_e5af03fa2d CHECK ((char_length(file) <= 255)) +); + +CREATE SEQUENCE packages_debian_project_component_files_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE packages_debian_project_component_files_id_seq OWNED BY packages_debian_project_component_files.id; + CREATE TABLE packages_debian_project_components ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -19021,12 +19071,16 @@ ALTER TABLE ONLY packages_conan_metadata ALTER COLUMN id SET DEFAULT nextval('pa ALTER TABLE ONLY packages_debian_group_architectures ALTER COLUMN id SET DEFAULT nextval('packages_debian_group_architectures_id_seq'::regclass); +ALTER TABLE ONLY packages_debian_group_component_files ALTER COLUMN id SET DEFAULT nextval('packages_debian_group_component_files_id_seq'::regclass); + ALTER TABLE ONLY packages_debian_group_components ALTER COLUMN id SET DEFAULT nextval('packages_debian_group_components_id_seq'::regclass); ALTER TABLE ONLY packages_debian_group_distributions ALTER COLUMN id SET DEFAULT nextval('packages_debian_group_distributions_id_seq'::regclass); ALTER TABLE ONLY packages_debian_project_architectures ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_architectures_id_seq'::regclass); +ALTER TABLE ONLY packages_debian_project_component_files ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_component_files_id_seq'::regclass); + ALTER TABLE ONLY packages_debian_project_components ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_components_id_seq'::regclass); ALTER TABLE ONLY packages_debian_project_distributions ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_distributions_id_seq'::regclass); @@ -20401,6 +20455,9 @@ ALTER TABLE ONLY packages_debian_file_metadata ALTER TABLE ONLY packages_debian_group_architectures ADD CONSTRAINT packages_debian_group_architectures_pkey PRIMARY KEY (id); +ALTER TABLE ONLY packages_debian_group_component_files + ADD CONSTRAINT packages_debian_group_component_files_pkey PRIMARY KEY (id); + ALTER TABLE ONLY packages_debian_group_components ADD CONSTRAINT packages_debian_group_components_pkey PRIMARY KEY (id); @@ -20410,6 +20467,9 @@ ALTER TABLE ONLY packages_debian_group_distributions ALTER TABLE ONLY packages_debian_project_architectures ADD CONSTRAINT packages_debian_project_architectures_pkey PRIMARY KEY (id); +ALTER TABLE ONLY packages_debian_project_component_files + ADD CONSTRAINT packages_debian_project_component_files_pkey PRIMARY KEY (id); + ALTER TABLE ONLY packages_debian_project_components ADD CONSTRAINT packages_debian_project_components_pkey PRIMARY KEY (id); @@ -21134,6 +21194,10 @@ CREATE UNIQUE INDEX idx_on_compliance_management_frameworks_namespace_id_name ON CREATE INDEX idx_packages_build_infos_on_package_id ON packages_build_infos USING btree (package_id); +CREATE INDEX idx_packages_debian_group_component_files_on_architecture_id ON packages_debian_group_component_files USING btree (architecture_id); + +CREATE INDEX idx_packages_debian_project_component_files_on_architecture_id ON packages_debian_project_component_files USING btree (architecture_id); + CREATE INDEX idx_packages_packages_on_project_id_name_version_package_type ON packages_packages USING btree (project_id, name, version, package_type); CREATE INDEX idx_pkgs_deb_grp_architectures_on_distribution_id ON packages_debian_group_architectures USING btree (distribution_id); @@ -22636,10 +22700,14 @@ CREATE UNIQUE INDEX index_packages_conan_file_metadata_on_package_file_id ON pac CREATE UNIQUE INDEX index_packages_conan_metadata_on_package_id_username_channel ON packages_conan_metadata USING btree (package_id, package_username, package_channel); +CREATE INDEX index_packages_debian_group_component_files_on_component_id ON packages_debian_group_component_files USING btree (component_id); + CREATE INDEX index_packages_debian_group_distributions_on_creator_id ON packages_debian_group_distributions USING btree (creator_id); CREATE INDEX index_packages_debian_group_distributions_on_group_id ON packages_debian_group_distributions USING btree (group_id); +CREATE INDEX index_packages_debian_project_component_files_on_component_id ON packages_debian_project_component_files USING btree (component_id); + CREATE INDEX index_packages_debian_project_distributions_on_creator_id ON packages_debian_project_distributions USING btree (creator_id); CREATE INDEX index_packages_debian_project_distributions_on_project_id ON packages_debian_project_distributions USING btree (project_id); @@ -24850,6 +24918,9 @@ ALTER TABLE ONLY group_group_links ALTER TABLE ONLY geo_repository_updated_events ADD CONSTRAINT fk_rails_2b70854c08 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY packages_debian_group_component_files + ADD CONSTRAINT fk_rails_2b8992dd83 FOREIGN KEY (architecture_id) REFERENCES packages_debian_group_architectures(id) ON DELETE RESTRICT; + ALTER TABLE ONLY boards_epic_board_labels ADD CONSTRAINT fk_rails_2bedeb8799 FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE CASCADE; @@ -25621,6 +25692,9 @@ ALTER TABLE ONLY merge_trains ALTER TABLE ONLY application_settings ADD CONSTRAINT fk_rails_b53e481273 FOREIGN KEY (custom_project_templates_group_id) REFERENCES namespaces(id) ON DELETE SET NULL; +ALTER TABLE ONLY packages_debian_project_component_files + ADD CONSTRAINT fk_rails_b543a9622b FOREIGN KEY (architecture_id) REFERENCES packages_debian_project_architectures(id) ON DELETE RESTRICT; + ALTER TABLE ONLY namespace_aggregation_schedules ADD CONSTRAINT fk_rails_b565c8d16c FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; @@ -25645,6 +25719,9 @@ ALTER TABLE ONLY lists ALTER TABLE ONLY security_findings ADD CONSTRAINT fk_rails_bb63863cf1 FOREIGN KEY (scan_id) REFERENCES security_scans(id) ON DELETE CASCADE; +ALTER TABLE ONLY packages_debian_project_component_files + ADD CONSTRAINT fk_rails_bbe9ebfbd9 FOREIGN KEY (component_id) REFERENCES packages_debian_project_components(id) ON DELETE RESTRICT; + ALTER TABLE ONLY approval_merge_request_rules_users ADD CONSTRAINT fk_rails_bc8972fa55 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; @@ -25813,6 +25890,9 @@ ALTER TABLE ONLY vulnerability_occurrence_pipelines ALTER TABLE ONLY deployment_merge_requests ADD CONSTRAINT fk_rails_dcbce9f4df FOREIGN KEY (deployment_id) REFERENCES deployments(id) ON DELETE CASCADE; +ALTER TABLE ONLY packages_debian_group_component_files + ADD CONSTRAINT fk_rails_dd262386e9 FOREIGN KEY (component_id) REFERENCES packages_debian_group_components(id) ON DELETE RESTRICT; + ALTER TABLE ONLY user_callouts ADD CONSTRAINT fk_rails_ddfdd80f3d FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; |