Skip to content

Commit

Permalink
use OPENPROJECT_SKIP_DB_ENCODING_CHECK environment variable to skip d…
Browse files Browse the repository at this point in the history
…atabase encoding check
  • Loading branch information
toy committed Nov 22, 2024
1 parent 5922177 commit 580fb1c
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions config/initializers/05-check_db_encoding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,28 @@
# See COPYRIGHT and LICENSE files for more details.
#++

icu_incompatible_encodings = %w[
EUC_JIS_2004
LATIN10
MULE_INTERNAL
SQL_ASCII
WIN874
]
if ENV["OPENPROJECT_SKIP_DB_ENCODING_CHECK"].blank?
icu_incompatible_encodings = %w[
EUC_JIS_2004
LATIN10
MULE_INTERNAL
SQL_ASCII
WIN874
]

database_encoding = ActiveRecord::Base.connection.select_value("SHOW SERVER_ENCODING")
database_encoding = ActiveRecord::Base.connection.select_value("SHOW SERVER_ENCODING")

if database_encoding.in?(icu_incompatible_encodings)
abort <<~ERROR
INCOMPATIBLE DATABASE ENCODING DETECTED
if database_encoding.in?(icu_incompatible_encodings)
abort <<~ERROR
INCOMPATIBLE DATABASE ENCODING DETECTED
Your database encoding is #{database_encoding}, which is incompatible with ICU
collation used in OpenProject v15.
Your database encoding is #{database_encoding}, which is incompatible with ICU
collation used in OpenProject v15.
Please check the instructions on how to change database encoding:
https://www.openproject.org/docs/installation-and-operations/misc/changing-database-encoding/
ERROR
Please check the instructions on how to change database encoding:
https://www.openproject.org/docs/installation-and-operations/misc/changing-database-encoding/
This check can be skipped by setting environment variable OPENPROJECT_SKIP_DB_ENCODING_CHECK=true
ERROR
end
end

0 comments on commit 580fb1c

Please sign in to comment.