Class: Hanami::Model::Migrator::SQLiteAdapter Private

Inherits:
Adapter
  • Object
show all
Defined in:
lib/hanami/model/migrator/sqlite_adapter.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

SQLite3 Migrator

Since:

  • 0.4.0

Defined Under Namespace

Modules: Memory

Constant Summary

Constants inherited from Adapter

Adapter::MIGRATIONS_TABLE, Adapter::MIGRATIONS_TABLE_VERSION_COLUMN

Instance Method Summary collapse

Methods inherited from Adapter

for, #migrate, #rollback, #version

Constructor Details

#initialize(configuration) ⇒ SQLiteAdapter

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize adapter

Since:

  • 0.4.0



35
36
37
38
# File 'lib/hanami/model/migrator/sqlite_adapter.rb', line 35

def initialize(configuration)
  super
  extend Memory if memory?
end

Instance Method Details

#createObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.4.0



42
43
44
45
46
47
# File 'lib/hanami/model/migrator/sqlite_adapter.rb', line 42

def create
  path.dirname.mkpath
  FileUtils.touch(path)
rescue Errno::EACCES, Errno::EPERM
  raise MigrationError.new("Permission denied: #{path.sub(/\A\/\//, '')}")
end

#dropObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.4.0



51
52
53
54
55
# File 'lib/hanami/model/migrator/sqlite_adapter.rb', line 51

def drop
  path.delete
rescue Errno::ENOENT
  raise MigrationError.new("Cannot find database: #{path.sub(/\A\/\//, '')}")
end

#dumpObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.4.0



59
60
61
62
# File 'lib/hanami/model/migrator/sqlite_adapter.rb', line 59

def dump
  dump_structure
  dump_migrations_data
end

#loadObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.4.0



66
67
68
# File 'lib/hanami/model/migrator/sqlite_adapter.rb', line 66

def load
  load_structure
end