Skip to content
代码片段 群组 项目
未验证 提交 133f4815 编辑于 作者: Shane Maglangit's avatar Shane Maglangit 提交者: GitLab
浏览文件

Add namespace_id column to redirect_routes

The namespace_id will serve as the sharding key for the table. This
will be used to identify from which organization owns the resource.

Changelog: other
上级 702f68b1
No related branches found
No related tags found
2 合并请求!3031Merge per-main-jh to main-jh by luzhiyuan,!3030Merge per-main-jh to main-jh
# frozen_string_literal: true
class AddRedirectRoutesNamespaceId < Gitlab::Database::Migration[2.2]
milestone '17.10'
def change
add_column :redirect_routes, :namespace_id, :bigint
end
end
# frozen_string_literal: true
class IndexRedirectRoutesOnNamespaceId < Gitlab::Database::Migration[2.2]
disable_ddl_transaction!
milestone '17.10'
INDEX_NAME = 'index_redirect_routes_on_namespace_id'
def up
add_concurrent_index :redirect_routes, :namespace_id, name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :redirect_routes, INDEX_NAME
end
end
# frozen_string_literal: true
class AddRedirectRoutesNamespaceIdFk < Gitlab::Database::Migration[2.2]
milestone '17.10'
disable_ddl_transaction!
def up
add_concurrent_foreign_key :redirect_routes, :namespaces, column: :namespace_id, on_delete: :cascade
end
def down
remove_foreign_key :redirect_routes, column: :namespace_id
end
end
a68b885e8301b924ce7d3ea673f5d2fec279b1972f44ca4a678e602011338163
\ No newline at end of file
4f9245487eea4d87519e7ca7eaa55010b9f05c853af66a1acfec32ad32396e84
\ No newline at end of file
0ce25e706c72362ff8dc8eb120c459f16ba2f8695ff313563be502b5a5561a9a
\ No newline at end of file
...@@ -20628,7 +20628,8 @@ CREATE TABLE redirect_routes ( ...@@ -20628,7 +20628,8 @@ CREATE TABLE redirect_routes (
source_type character varying NOT NULL, source_type character varying NOT NULL,
path character varying NOT NULL, path character varying NOT NULL,
created_at timestamp without time zone NOT NULL, created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL updated_at timestamp without time zone NOT NULL,
namespace_id bigint
); );
   
CREATE SEQUENCE redirect_routes_id_seq CREATE SEQUENCE redirect_routes_id_seq
...@@ -34929,6 +34930,8 @@ CREATE INDEX index_raw_usage_data_on_organization_id ON raw_usage_data USING btr ...@@ -34929,6 +34930,8 @@ CREATE INDEX index_raw_usage_data_on_organization_id ON raw_usage_data USING btr
   
CREATE UNIQUE INDEX index_raw_usage_data_on_recorded_at ON raw_usage_data USING btree (recorded_at); CREATE UNIQUE INDEX index_raw_usage_data_on_recorded_at ON raw_usage_data USING btree (recorded_at);
   
CREATE INDEX index_redirect_routes_on_namespace_id ON redirect_routes USING btree (namespace_id);
CREATE UNIQUE INDEX index_redirect_routes_on_path ON redirect_routes USING btree (path); CREATE UNIQUE INDEX index_redirect_routes_on_path ON redirect_routes USING btree (path);
   
CREATE UNIQUE INDEX index_redirect_routes_on_path_unique_text_pattern_ops ON redirect_routes USING btree (lower((path)::text) varchar_pattern_ops); CREATE UNIQUE INDEX index_redirect_routes_on_path_unique_text_pattern_ops ON redirect_routes USING btree (lower((path)::text) varchar_pattern_ops);
...@@ -39084,6 +39087,9 @@ ALTER TABLE ONLY catalog_resource_versions ...@@ -39084,6 +39087,9 @@ ALTER TABLE ONLY catalog_resource_versions
ALTER TABLE ONLY merge_request_blocks ALTER TABLE ONLY merge_request_blocks
ADD CONSTRAINT fk_1551efdd17 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; ADD CONSTRAINT fk_1551efdd17 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
   
ALTER TABLE ONLY redirect_routes
ADD CONSTRAINT fk_157ba4733c FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
ALTER TABLE ONLY scan_result_policies ALTER TABLE ONLY scan_result_policies
ADD CONSTRAINT fk_159e8f8f79 FOREIGN KEY (approval_policy_rule_id) REFERENCES approval_policy_rules(id) ON DELETE CASCADE NOT VALID; ADD CONSTRAINT fk_159e8f8f79 FOREIGN KEY (approval_policy_rule_id) REFERENCES approval_policy_rules(id) ON DELETE CASCADE NOT VALID;
   
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册