Commit b10b06d8 authored by Mathieu Parent's avatar Mathieu Parent

Create packages_debian_{group,project}_distribution_keys tables

parent c17f8a2f
---
title: Debian Group and Project Distribution Keys schema
merge_request: 60993
author: Mathieu Parent
type: added
# frozen_string_literal: true
class CreatePackagesDebianGroupDistributionKeys < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_DISTRIBUTION = 'idx_pkgs_debian_group_distribution_keys_on_distribution_id'
disable_ddl_transaction!
def up
create_table_with_constraints :packages_debian_group_distribution_keys do |t|
t.timestamps_with_timezone
t.references :distribution,
foreign_key: { to_table: :packages_debian_group_distributions, on_delete: :cascade },
index: { name: INDEX_DISTRIBUTION },
null: false
t.text :encrypted_private_key, null: false
t.text :encrypted_private_key_iv, null: false
t.text :encrypted_passphrase, null: false
t.text :encrypted_passphrase_iv, null: false
t.text :public_key, null: false
t.text :fingerprint, null: false
t.text_limit :public_key, 512.kilobytes
t.text_limit :fingerprint, 255
end
end
def down
with_lock_retries do
drop_table :packages_debian_group_distribution_keys
end
end
end
# frozen_string_literal: true
class CreatePackagesDebianProjectDistributionKeys < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_DISTRIBUTION = 'idx_pkgs_debian_project_distribution_keys_on_distribution_id'
disable_ddl_transaction!
def up
create_table_with_constraints :packages_debian_project_distribution_keys do |t|
t.timestamps_with_timezone
t.references :distribution,
foreign_key: { to_table: :packages_debian_project_distributions, on_delete: :cascade },
index: { name: INDEX_DISTRIBUTION },
null: false
t.text :encrypted_private_key, null: false
t.text :encrypted_private_key_iv, null: false
t.text :encrypted_passphrase, null: false
t.text :encrypted_passphrase_iv, null: false
t.text :public_key, null: false
t.text :fingerprint, null: false
t.text_limit :public_key, 512.kilobytes
t.text_limit :fingerprint, 255
end
end
def down
with_lock_retries do
drop_table :packages_debian_project_distribution_keys
end
end
end
52cc795e577a6de524cc55ce8d11f140e5d919f1164bb9983f7dd2c1ef2f0859
\ No newline at end of file
7d57e1fea3652c0c04d29261d3c21b314ed443c9e61b882d22ca7f59807c312b
\ No newline at end of file
......@@ -15530,6 +15530,30 @@ CREATE SEQUENCE packages_debian_group_components_id_seq
ALTER SEQUENCE packages_debian_group_components_id_seq OWNED BY packages_debian_group_components.id;
CREATE TABLE packages_debian_group_distribution_keys (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
distribution_id bigint NOT NULL,
encrypted_private_key text NOT NULL,
encrypted_private_key_iv text NOT NULL,
encrypted_passphrase text NOT NULL,
encrypted_passphrase_iv text NOT NULL,
public_key text NOT NULL,
fingerprint text NOT NULL,
CONSTRAINT check_bc95dc3fbe CHECK ((char_length(fingerprint) <= 255)),
CONSTRAINT check_f708183491 CHECK ((char_length(public_key) <= 524288))
);
CREATE SEQUENCE packages_debian_group_distribution_keys_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE packages_debian_group_distribution_keys_id_seq OWNED BY packages_debian_group_distribution_keys.id;
CREATE TABLE packages_debian_group_distributions (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
......@@ -15632,6 +15656,30 @@ CREATE SEQUENCE packages_debian_project_components_id_seq
ALTER SEQUENCE packages_debian_project_components_id_seq OWNED BY packages_debian_project_components.id;
CREATE TABLE packages_debian_project_distribution_keys (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
distribution_id bigint NOT NULL,
encrypted_private_key text NOT NULL,
encrypted_private_key_iv text NOT NULL,
encrypted_passphrase text NOT NULL,
encrypted_passphrase_iv text NOT NULL,
public_key text NOT NULL,
fingerprint text NOT NULL,
CONSTRAINT check_9e8a5eef0a CHECK ((char_length(fingerprint) <= 255)),
CONSTRAINT check_d188f6547f CHECK ((char_length(public_key) <= 524288))
);
CREATE SEQUENCE packages_debian_project_distribution_keys_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE packages_debian_project_distribution_keys_id_seq OWNED BY packages_debian_project_distribution_keys.id;
CREATE TABLE packages_debian_project_distributions (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
......@@ -19943,6 +19991,8 @@ ALTER TABLE ONLY packages_debian_group_component_files ALTER COLUMN id SET DEFAU
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_distribution_keys ALTER COLUMN id SET DEFAULT nextval('packages_debian_group_distribution_keys_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);
......@@ -19951,6 +20001,8 @@ ALTER TABLE ONLY packages_debian_project_component_files ALTER COLUMN id SET DEF
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_distribution_keys ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_distribution_keys_id_seq'::regclass);
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);
......@@ -21412,6 +21464,9 @@ ALTER TABLE ONLY packages_debian_group_component_files
ALTER TABLE ONLY packages_debian_group_components
ADD CONSTRAINT packages_debian_group_components_pkey PRIMARY KEY (id);
ALTER TABLE ONLY packages_debian_group_distribution_keys
ADD CONSTRAINT packages_debian_group_distribution_keys_pkey PRIMARY KEY (id);
ALTER TABLE ONLY packages_debian_group_distributions
ADD CONSTRAINT packages_debian_group_distributions_pkey PRIMARY KEY (id);
......@@ -21424,6 +21479,9 @@ ALTER TABLE ONLY packages_debian_project_component_files
ALTER TABLE ONLY packages_debian_project_components
ADD CONSTRAINT packages_debian_project_components_pkey PRIMARY KEY (id);
ALTER TABLE ONLY packages_debian_project_distribution_keys
ADD CONSTRAINT packages_debian_project_distribution_keys_pkey PRIMARY KEY (id);
ALTER TABLE ONLY packages_debian_project_distributions
ADD CONSTRAINT packages_debian_project_distributions_pkey PRIMARY KEY (id);
......@@ -22201,6 +22259,10 @@ CREATE INDEX idx_packages_debian_project_component_files_on_architecture_id ON p
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_debian_group_distribution_keys_on_distribution_id ON packages_debian_group_distribution_keys USING btree (distribution_id);
CREATE INDEX idx_pkgs_debian_project_distribution_keys_on_distribution_id ON packages_debian_project_distribution_keys USING btree (distribution_id);
CREATE UNIQUE INDEX idx_pkgs_dep_links_on_pkg_id_dependency_id_dependency_type ON packages_dependency_links USING btree (package_id, dependency_id, dependency_type);
CREATE INDEX idx_proj_feat_usg_on_jira_dvcs_cloud_last_sync_at_and_proj_id ON project_feature_usages USING btree (jira_dvcs_cloud_last_sync_at, project_id) WHERE (jira_dvcs_cloud_last_sync_at IS NOT NULL);
......@@ -26253,6 +26315,9 @@ ALTER TABLE ONLY group_merge_request_approval_settings
ALTER TABLE ONLY analytics_cycle_analytics_project_stages
ADD CONSTRAINT fk_rails_3829e49b66 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY packages_debian_project_distribution_keys
ADD CONSTRAINT fk_rails_3834a11264 FOREIGN KEY (distribution_id) REFERENCES packages_debian_project_distributions(id) ON DELETE CASCADE;
ALTER TABLE ONLY issue_user_mentions
ADD CONSTRAINT fk_rails_3861d9fefa FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;
......@@ -26661,6 +26726,9 @@ ALTER TABLE ONLY packages_debian_publications
ALTER TABLE ONLY boards_epic_user_preferences
ADD CONSTRAINT fk_rails_76c4e9732d FOREIGN KEY (epic_id) REFERENCES epics(id) ON DELETE CASCADE;
ALTER TABLE ONLY packages_debian_group_distribution_keys
ADD CONSTRAINT fk_rails_779438f163 FOREIGN KEY (distribution_id) REFERENCES packages_debian_group_distributions(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_subscriptions_projects
ADD CONSTRAINT fk_rails_7871f9a97b FOREIGN KEY (upstream_project_id) REFERENCES projects(id) ON DELETE CASCADE;
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