Defect #26615 ยป fix-schema_migrations_table_name-warning.diff
| lib/redmine/plugin.rb (working copy) | ||
|---|---|---|
| 483 | 483 | |
| 484 | 484 |
def current_version(plugin=current_plugin) |
| 485 | 485 |
# Delete migrations that don't match .. to_i will work because the number comes first |
| 486 |
sm_table = ::ActiveRecord::SchemaMigration.table_name |
|
| 486 | 487 |
::ActiveRecord::Base.connection.select_values( |
| 487 |
"SELECT version FROM #{schema_migrations_table_name}"
|
|
| 488 |
"SELECT version FROM #{sm_table}"
|
|
| 488 | 489 |
).delete_if{ |v| v.match(/-#{plugin.id}$/) == nil }.map(&:to_i).max || 0
|
| 489 | 490 |
end |
| 490 | 491 |
end |
| 491 | 492 | |
| 492 | 493 |
def migrated |
| 493 |
sm_table = self.class.schema_migrations_table_name
|
|
| 494 |
sm_table = ::ActiveRecord::SchemaMigration.table_name
|
|
| 494 | 495 |
::ActiveRecord::Base.connection.select_values( |
| 495 | 496 |
"SELECT version FROM #{sm_table}"
|
| 496 | 497 |
).delete_if{ |v| v.match(/-#{current_plugin.id}$/) == nil }.map(&:to_i).sort
|