Class: RedminePluginsHelper::Migration

Inherits:
Object
  • Object
show all
Defined in:
lib/redmine_plugins_helper/migration.rb,
lib/redmine_plugins_helper/migration/code.rb,
lib/redmine_plugins_helper/migration/database.rb

Defined Under Namespace

Modules: Code, Database

Constant Summary collapse

PLUGIN_ID_CORE_VALUE =
:_core_

Instance Method Summary collapse

Instance Method Details

#applied?Boolean

Returns:

  • (Boolean)


15
16
17
18
# File 'lib/redmine_plugins_helper/migration.rb', line 15

def applied?
  ::ActiveRecord::SchemaMigration.create_table
  ::ActiveRecord::SchemaMigration.where(version: database_version).any?
end

#core?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/redmine_plugins_helper/migration.rb', line 26

def core?
  plugin_id == PLUGIN_ID_CORE_VALUE
end

#database_versionString

Returns:

  • (String)


21
22
23
# File 'lib/redmine_plugins_helper/migration.rb', line 21

def database_version
  core? ? version.to_s : "#{version}-#{plugin_id}"
end

#plugin?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/redmine_plugins_helper/migration.rb', line 31

def plugin?
  !core?
end