1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-04 22:59:47 +00:00

fix "schema_migrations_table_name is deprecated" warning during redmine:plugins:migrate (#26615)

Contributed by Go MAEDA.

git-svn-id: http://svn.redmine.org/redmine/trunk@16962 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2017-08-31 15:57:43 +00:00
parent 9fcc66b4dd
commit 6455e0431f

View File

@ -483,14 +483,15 @@ module Redmine #:nodoc:
def current_version(plugin=current_plugin)
# Delete migrations that don't match .. to_i will work because the number comes first
sm_table = ::ActiveRecord::SchemaMigration.table_name
::ActiveRecord::Base.connection.select_values(
"SELECT version FROM #{schema_migrations_table_name}"
"SELECT version FROM #{sm_table}"
).delete_if{ |v| v.match(/-#{plugin.id}$/) == nil }.map(&:to_i).max || 0
end
end
def migrated
sm_table = self.class.schema_migrations_table_name
sm_table = ::ActiveRecord::SchemaMigration.table_name
::ActiveRecord::Base.connection.select_values(
"SELECT version FROM #{sm_table}"
).delete_if{ |v| v.match(/-#{current_plugin.id}$/) == nil }.map(&:to_i).sort