Merge pull request #7678 from opf/fix/mysql-error

Move mysql error early into application boot

[ci skip]
pull/7680/head
Oliver Günther 5 years ago committed by GitHub
commit 21e0667932
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 23
      config/application.rb
  2. 20
      config/initializers/01-mysql-error.rb

@ -73,6 +73,29 @@ end
require File.dirname(__FILE__) + '/../lib/open_project/configuration' require File.dirname(__FILE__) + '/../lib/open_project/configuration'
env = ENV['RAILS_ENV'] || 'production'
db_config = ActiveRecord::Base.configurations[env] || {}
db_adapter = db_config['adapter']
if db_adapter&.start_with? 'mysql'
warn <<~ERROR
======= INCOMPATIBLE DATABASE DETECTED =======
Your database is set up for use with a MySQL or MySQL-compatible variant.
This installation of OpenProject 10.0. no longer supports these variants.
The following guides provide extensive documentation for migrating
your installation to a PostgreSQL database:
https://www.openproject.org/migration-guides/
This process is mostly automated so you can continue using your
OpenProject installation within a few minutes!
==============================================
ERROR
Kernel.exit 1
end
module OpenProject module OpenProject
class Application < Rails::Application class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here. # Settings in config/environments/* take precedence over those specified here.

@ -1,20 +0,0 @@
db_adapter = ActiveRecord::Base.configurations[Rails.env]['adapter']
if db_adapter.start_with? 'mysql'
warn <<~ERROR
======= INCOMPATIBLE DATABASE DETECTED =======
Your database is set up for use with a MySQL or MySQL-compatible variant.
This installation of OpenProject 10.0. no longer supports these variants.
The following guides provide extensive documentation for migrating
your installation to a PostgreSQL database:
https://www.openproject.org/migration-guides/
This process is mostly automated so you can continue using your
OpenProject installation within a few minutes!
==============================================
ERROR
Kernel.exit 1
end
Loading…
Cancel
Save