blob: 80ecc23dfbe48b308fee40e2659f7aa9c619ebca (
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
|
# frozen_string_literal: true
require 'spec_helper'
require_migration!
RSpec.describe RecreateIndexSecurityCiBuildsOnNameAndIdParserFeatures, :migration, feature_category: :database do
let(:db) { described_class.new }
let(:pg_class) { table(:pg_class) }
let(:pg_index) { table(:pg_index) }
let(:async_indexes) { table(:postgres_async_indexes) }
it "recreates index" do
reversible_migration do |migration|
migration.before -> {
expect(async_indexes.where(name: described_class::OLD_INDEX_NAME).exists?).to be false
expect(db.index_exists?(described_class::TABLE, described_class::COLUMNS, name: described_class::OLD_INDEX_NAME)).to be true
expect(db.index_exists?(described_class::TABLE, described_class::COLUMNS, name: described_class::NEW_INDEX_NAME)).to be false
}
migration.after -> {
expect(async_indexes.where(name: described_class::OLD_INDEX_NAME).exists?).to be true
expect(db.index_exists?(described_class::TABLE, described_class::COLUMNS, name: described_class::OLD_INDEX_NAME)).to be false
expect(db.index_exists?(described_class::TABLE, described_class::COLUMNS, name: described_class::NEW_INDEX_NAME)).to be true
}
end
end
end
|