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


33
34
35
36
# File 'lib/hanami/model/migrator/sqlite_adapter.rb', line 33

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


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

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


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

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


57
58
59
60
# File 'lib/hanami/model/migrator/sqlite_adapter.rb', line 57

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


64
65
66
# File 'lib/hanami/model/migrator/sqlite_adapter.rb', line 64

def load
  load_structure
end