Skip to content

Add support for embedding to migration helpers

Jan Provaznik requested to merge jp-embedding-helper into master

What does this MR do and why?

Makes migration helper more generic to support not only geo migration, but also embedding DB.

Related to https://gitlab.com/gitlab-org/gitlab/-/issues/411390. This MR was already merged once a while ago (!120998 (merged)) but had to be reverted because of dependency on another MR which was being reverted (https://gitlab.com/gitlab-org/gitlab/-/issues/411390#note_1397071633).

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  1. create a testing migration spec:
$ cat ee/db/embedding/migrate/20230517080722_test_embedding.rb
# frozen_string_literal: true

class TestEmbedding < Gitlab::Database::Migration[2.1]
  def change
    add_column :tanuki_bot_mvc, :test_column, :integer
  end
end

$ cat ee/spec/migrations/20230517080722_test_embedding_spec.rb
# frozen_string_literal: true

require 'spec_helper'
require_migration!

RSpec.describe TestEmbedding, :embedding do
  let(:tanuki_bot_mvc) { table(:tanuki_bot_mvc, database: :embedding) }

  it 'runs migration' do
    expect { migrate! }.not_to raise_error
  end
end
  1. verify it's executed on embedding database

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports