2019-06-24 17:07:37 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2021-06-11 14:10:13 -04:00
|
|
|
require_migration!
|
2019-06-24 17:07:37 -04:00
|
|
|
|
2020-06-24 14:09:03 -04:00
|
|
|
RSpec.describe BackportEnterpriseSchema, schema: 20190329085614 do
|
2019-06-24 17:07:37 -04:00
|
|
|
include MigrationsHelpers
|
|
|
|
|
|
|
|
def drop_if_exists(table)
|
|
|
|
active_record_base.connection.drop_table(table) if active_record_base.connection.table_exists?(table)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#up' do
|
|
|
|
it 'creates new EE tables' do
|
|
|
|
migrate!
|
|
|
|
|
|
|
|
expect(active_record_base.connection.table_exists?(:epics)).to be true
|
|
|
|
expect(active_record_base.connection.table_exists?(:geo_nodes)).to be true
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'missing EE columns' do
|
|
|
|
before do
|
|
|
|
drop_if_exists(:epics)
|
|
|
|
|
|
|
|
active_record_base.connection.create_table "epics" do |t|
|
|
|
|
t.integer :group_id, null: false, index: true
|
|
|
|
t.integer :author_id, null: false, index: true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
after do
|
|
|
|
drop_if_exists(:epics)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'flags an error' do
|
|
|
|
expect { migrate! }.to raise_error(/Your database is missing.*that is present for GitLab EE/)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|