Class: Lotus::Model::Migrator::SQLiteAdapter Private

Inherits:
Adapter
  • Object
show all
Defined in:
lib/lotus/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, #version

Constructor Details

#initialize(connection) ⇒ 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



31
32
33
34
# File 'lib/lotus/model/migrator/sqlite_adapter.rb', line 31

def initialize(connection)
  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



38
39
40
41
42
43
# File 'lib/lotus/model/migrator/sqlite_adapter.rb', line 38

def create
  path.dirname.mkpath
  FileUtils.touch(path)
rescue Errno::EACCES
  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



47
48
49
50
51
# File 'lib/lotus/model/migrator/sqlite_adapter.rb', line 47

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



55
56
57
58
# File 'lib/lotus/model/migrator/sqlite_adapter.rb', line 55

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



62
63
64
# File 'lib/lotus/model/migrator/sqlite_adapter.rb', line 62

def load
  load_structure
end