blob: 9086700c513b4b99d2958e807c9417029eb8e53a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# frozen_string_literal: true
require 'spec_helper'
require_migration!
RSpec.describe AddGitlabSchemaToBatchedBackgroundMigrations, feature_category: :database do
it 'sets gitlab_schema for existing methods to "gitlab_main" and default to NULL' do
batched_migrations = table(:batched_background_migrations)
batched_migration = batched_migrations.create!(
id: 1, created_at: Time.now, updated_at: Time.now,
max_value: 100, batch_size: 100, sub_batch_size: 10, interval: 120,
job_class_name: 'TestJob', table_name: '_test', column_name: 'id'
)
reversible_migration do |migration|
migration.before -> {
batched_migrations.reset_column_information
column = batched_migrations.columns.find { |column| column.name == 'gitlab_schema' }
expect(column).to be_nil
}
migration.after -> {
expect(batched_migration.reload.gitlab_schema).to eq('gitlab_main')
batched_migrations.reset_column_information
column = batched_migrations.columns.find { |column| column.name == 'gitlab_schema' }
expect(column).to be
expect(column.default).to be_nil
}
end
end
end
|