Commit 0f45394d authored by Adam Hegyi's avatar Adam Hegyi

Merge branch 'pb-allow-schema-mapping-of-temp-tables' into 'master'

Allow test tables to specify a schema mapping

See merge request gitlab-org/gitlab!79025
parents a35c1e1e 1f79ef74
......@@ -78,7 +78,11 @@ module Gitlab
# All tables from `information_schema.` are `:gitlab_shared`
return :gitlab_shared if schema_name == 'information_schema'
# All tables that start with `_test_` are shared and ignored
return :gitlab_main if table_name.start_with?('_test_gitlab_main_')
return :gitlab_ci if table_name.start_with?('_test_gitlab_ci_')
# All tables that start with `_test_` without a following schema are shared and ignored
return :gitlab_shared if table_name.start_with?('_test_')
# All `pg_` tables are marked as `shared`
......
......@@ -44,6 +44,8 @@ RSpec.describe Gitlab::Database::GitlabSchema do
'my_schema.ci_builds' | :gitlab_ci
'information_schema.columns' | :gitlab_shared
'audit_events_part_5fc467ac26' | :gitlab_main
'_test_gitlab_main_table' | :gitlab_main
'_test_gitlab_ci_table' | :gitlab_ci
'_test_my_table' | :gitlab_shared
'pg_attribute' | :gitlab_shared
'my_other_table' | :undefined_my_other_table
......
......@@ -75,7 +75,7 @@ RSpec.describe AfterCommitQueue do
skip_if_multiple_databases_not_setup
table_sql = <<~SQL
CREATE TABLE _test_ci_after_commit_queue (
CREATE TABLE _test_gitlab_ci_after_commit_queue (
id serial NOT NULL PRIMARY KEY);
SQL
......@@ -84,7 +84,7 @@ RSpec.describe AfterCommitQueue do
let(:ci_klass) do
Class.new(Ci::ApplicationRecord) do
self.table_name = '_test_ci_after_commit_queue'
self.table_name = '_test_gitlab_ci_after_commit_queue'
include AfterCommitQueue
......
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