diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-08 12:09:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-08 12:09:30 +0300 |
commit | 1c6e8c149861e1027da40622536b5276c46a7408 (patch) | |
tree | fe2c3e647536f8369d97ce224cfe3fc82d1efa8b /db | |
parent | e9f7a727593f6df2f4ca837d2fcf8f401a2b2b31 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20201204111600_create_packages_debian_publications.rb | 19 | ||||
-rw-r--r-- | db/post_migrate/20210205174154_remove_bad_dependency_proxy_manifests.rb | 15 | ||||
-rw-r--r-- | db/schema_migrations/20201204111600 | 1 | ||||
-rw-r--r-- | db/schema_migrations/20210205174154 | 1 | ||||
-rw-r--r-- | db/structure.sql | 30 |
5 files changed, 66 insertions, 0 deletions
diff --git a/db/migrate/20201204111600_create_packages_debian_publications.rb b/db/migrate/20201204111600_create_packages_debian_publications.rb new file mode 100644 index 00000000000..2fd26c2c367 --- /dev/null +++ b/db/migrate/20201204111600_create_packages_debian_publications.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class CreatePackagesDebianPublications < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table :packages_debian_publications do |t| + t.references :package, + index: { unique: true }, + null: false, + foreign_key: { to_table: :packages_packages, on_delete: :cascade } + t.references :distribution, + null: false, + foreign_key: { to_table: :packages_debian_project_distributions, on_delete: :cascade } + end + end +end diff --git a/db/post_migrate/20210205174154_remove_bad_dependency_proxy_manifests.rb b/db/post_migrate/20210205174154_remove_bad_dependency_proxy_manifests.rb new file mode 100644 index 00000000000..eb302fb7009 --- /dev/null +++ b/db/post_migrate/20210205174154_remove_bad_dependency_proxy_manifests.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class RemoveBadDependencyProxyManifests < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + # We run destroy on each record because we need the callback to remove + # the underlying files + DependencyProxy::Manifest.where.not(content_type: nil).destroy_all # rubocop:disable Cop/DestroyAll + end + + def down + # no op + end +end diff --git a/db/schema_migrations/20201204111600 b/db/schema_migrations/20201204111600 new file mode 100644 index 00000000000..d6c5e232962 --- /dev/null +++ b/db/schema_migrations/20201204111600 @@ -0,0 +1 @@ +51967d740ce184b27d0d9417fc86cb896fd3e3aa8a5e40759b290f47b9f3e99b
\ No newline at end of file diff --git a/db/schema_migrations/20210205174154 b/db/schema_migrations/20210205174154 new file mode 100644 index 00000000000..fc8c4b6cff1 --- /dev/null +++ b/db/schema_migrations/20210205174154 @@ -0,0 +1 @@ +483d1b4a24086fa57efe7f3b3fa872cf793352f80aba5c25614f07eafa2d30c5
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index e9628af9a0d..8c1ed479c69 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -15030,6 +15030,21 @@ CREATE SEQUENCE packages_debian_project_distributions_id_seq ALTER SEQUENCE packages_debian_project_distributions_id_seq OWNED BY packages_debian_project_distributions.id; +CREATE TABLE packages_debian_publications ( + id bigint NOT NULL, + package_id bigint NOT NULL, + distribution_id bigint NOT NULL +); + +CREATE SEQUENCE packages_debian_publications_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE packages_debian_publications_id_seq OWNED BY packages_debian_publications.id; + CREATE TABLE packages_dependencies ( id bigint NOT NULL, name character varying(255) NOT NULL, @@ -19015,6 +19030,8 @@ ALTER TABLE ONLY packages_debian_project_components ALTER COLUMN id SET DEFAULT ALTER TABLE ONLY packages_debian_project_distributions ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_distributions_id_seq'::regclass); +ALTER TABLE ONLY packages_debian_publications ALTER COLUMN id SET DEFAULT nextval('packages_debian_publications_id_seq'::regclass); + ALTER TABLE ONLY packages_dependencies ALTER COLUMN id SET DEFAULT nextval('packages_dependencies_id_seq'::regclass); ALTER TABLE ONLY packages_dependency_links ALTER COLUMN id SET DEFAULT nextval('packages_dependency_links_id_seq'::regclass); @@ -20398,6 +20415,9 @@ ALTER TABLE ONLY packages_debian_project_components ALTER TABLE ONLY packages_debian_project_distributions ADD CONSTRAINT packages_debian_project_distributions_pkey PRIMARY KEY (id); +ALTER TABLE ONLY packages_debian_publications + ADD CONSTRAINT packages_debian_publications_pkey PRIMARY KEY (id); + ALTER TABLE ONLY packages_dependencies ADD CONSTRAINT packages_dependencies_pkey PRIMARY KEY (id); @@ -22623,6 +22643,10 @@ CREATE INDEX index_packages_debian_project_distributions_on_creator_id ON packag CREATE INDEX index_packages_debian_project_distributions_on_project_id ON packages_debian_project_distributions USING btree (project_id); +CREATE INDEX index_packages_debian_publications_on_distribution_id ON packages_debian_publications USING btree (distribution_id); + +CREATE UNIQUE INDEX index_packages_debian_publications_on_package_id ON packages_debian_publications USING btree (package_id); + CREATE UNIQUE INDEX index_packages_dependencies_on_name_and_version_pattern ON packages_dependencies USING btree (name, version_pattern); CREATE INDEX index_packages_dependency_links_on_dependency_id ON packages_dependency_links USING btree (dependency_id); @@ -25032,6 +25056,9 @@ ALTER TABLE ONLY aws_roles ALTER TABLE ONLY security_scans ADD CONSTRAINT fk_rails_4ef1e6b4c6 FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE; +ALTER TABLE ONLY packages_debian_publications + ADD CONSTRAINT fk_rails_4fc8ebd03e FOREIGN KEY (distribution_id) REFERENCES packages_debian_project_distributions(id) ON DELETE CASCADE; + ALTER TABLE ONLY merge_request_diff_files ADD CONSTRAINT fk_rails_501aa0a391 FOREIGN KEY (merge_request_diff_id) REFERENCES merge_request_diffs(id) ON DELETE CASCADE; @@ -25275,6 +25302,9 @@ ALTER TABLE ONLY x509_certificates ALTER TABLE ONLY pages_domain_acme_orders ADD CONSTRAINT fk_rails_76581b1c16 FOREIGN KEY (pages_domain_id) REFERENCES pages_domains(id) ON DELETE CASCADE; +ALTER TABLE ONLY packages_debian_publications + ADD CONSTRAINT fk_rails_7668c1d606 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE; + ALTER TABLE ONLY boards_epic_user_preferences ADD CONSTRAINT fk_rails_76c4e9732d FOREIGN KEY (epic_id) REFERENCES epics(id) ON DELETE CASCADE; |