Commit 8b06aeac authored by Thong Kuah's avatar Thong Kuah

Merge branch 'rpereira2-remove-self-monitoring-migration' into 'master'

Remove self monitoring migration

See merge request gitlab-org/gitlab!16864
parents fc1631bb 668a4386
---
title: Create a project for self-monitoring the GitLab instance
merge_request: 31389
author:
type: added
# frozen_string_literal: true
::Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService.new.execute!
# frozen_string_literal: true
::Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService.new.execute!
# frozen_string_literal: true
class AddGitlabInstanceAdministrationProject < ActiveRecord::Migration[5.2]
DOWNTIME = false
disable_ddl_transaction!
def up
BackgroundMigrationWorker.perform_async('AddGitlabInstanceAdministrationProject', [])
end
def down
ApplicationSetting.current_without_cache
&.instance_administration_project
&.owner
&.destroy!
end
end
# frozen_string_literal: true
require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20190801072937_add_gitlab_instance_administration_project.rb')
describe AddGitlabInstanceAdministrationProject, :migration do
let(:application_settings) { table(:application_settings) }
let(:users) { table(:users) }
let(:prometheus_settings) do
{
enable: true,
listen_address: 'localhost:9090'
}
end
before do
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
stub_config(prometheus: prometheus_settings)
end
describe 'down' do
let!(:application_setting) { application_settings.create! }
let!(:user) { users.create!(admin: true, email: 'admin1@example.com', projects_limit: 10, state: :active) }
it 'deletes group and project' do
migrate!
expect(Project.count).to eq(1)
expect(Group.count).to eq(1)
schema_migrate_down!
expect(Project.count).to eq(0)
expect(Group.count).to eq(0)
end
end
end
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