Defect #26615 ยป fix-schema_migrations_table_name-warning.diff
| lib/redmine/plugin.rb (working copy) | ||
|---|---|---|
|
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
|
||