Module: ActualDbSchema

Defined in:
lib/actual_db_schema.rb,
lib/actual_db_schema/git.rb,
lib/actual_db_schema/store.rb,
lib/actual_db_schema/engine.rb,
lib/actual_db_schema/version.rb,
lib/actual_db_schema/migration.rb,
lib/actual_db_schema/commands/base.rb,
lib/actual_db_schema/commands/list.rb,
lib/actual_db_schema/failed_migration.rb,
lib/actual_db_schema/patches/migrator.rb,
lib/actual_db_schema/commands/rollback.rb,
lib/actual_db_schema/migration_context.rb,
lib/actual_db_schema/patches/migration_proxy.rb,
lib/actual_db_schema/patches/migration_context.rb,
app/controllers/actual_db_schema/migrations_controller.rb,
app/controllers/actual_db_schema/phantom_migrations_controller.rb

Overview

The main module definition

Defined Under Namespace

Modules: Commands, Patches Classes: Engine, FailedMigration, Git, Migration, MigrationContext, MigrationsController, PhantomMigrationsController, Store

Constant Summary collapse

VERSION =
"0.7.9"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config.



25
26
27
# File 'lib/actual_db_schema.rb', line 25

def config
  @config
end

.failedObject

Returns the value of attribute failed.



25
26
27
# File 'lib/actual_db_schema.rb', line 25

def failed
  @failed
end

Class Method Details

.db_configObject



64
65
66
67
68
69
70
# File 'lib/actual_db_schema.rb', line 64

def self.db_config
  if ActiveRecord::Base.respond_to?(:connection_db_config)
    ActiveRecord::Base.connection_db_config.configuration_hash
  else
    ActiveRecord::Base.connection_config
  end
end

.default_migrated_folderObject



52
53
54
# File 'lib/actual_db_schema.rb', line 52

def self.default_migrated_folder
  Rails.root.join("tmp", "migrated")
end

.migrated_folderObject



35
36
37
# File 'lib/actual_db_schema.rb', line 35

def self.migrated_folder
  migrated_folders.first
end

.migrated_foldersObject



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/actual_db_schema.rb', line 39

def self.migrated_folders
  return [default_migrated_folder] unless migrations_paths

  Array(migrations_paths).map do |path|
    if path.end_with?("db/migrate")
      default_migrated_folder
    else
      postfix = path.split("/").last
      Rails.root.join("tmp", "migrated_#{postfix}")
    end
  end
end

.migration_filename(fullpath) ⇒ Object



72
73
74
# File 'lib/actual_db_schema.rb', line 72

def self.migration_filename(fullpath)
  fullpath.split("/").last
end

.migrations_pathsObject



56
57
58
59
60
61
62
# File 'lib/actual_db_schema.rb', line 56

def self.migrations_paths
  if ActiveRecord::Base.respond_to?(:connection_db_config)
    ActiveRecord::Base.connection_db_config.migrations_paths
  else
    ActiveRecord::Base.connection_config[:migrations_paths]
  end
end