Module: DataMapper::Migrations::SqliteAdapter

Includes:
DataObjectsAdapter, SQL
Defined in:
lib/dm-migrations/adapters/dm-sqlite-adapter.rb

Defined Under Namespace

Modules: ClassMethods, SQL

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SQL

#create_table_statement, #property_schema_statement, #sqlite_version, #supports_drop_table_if_exists?, #supports_serial?, #table_info

Methods included from DataObjectsAdapter

#create_model_storage, #destroy_model_storage, #upgrade_model_storage

Methods included from DataObjectsAdapter::SQL

#add_column_statement, #alter_table_add_column_statement, #create_index_statement, #create_index_statements, #create_table_statement, #create_unique_index_statements, #drop_table_statement, #indexes, #property_schema_hash, #property_schema_statement, #schema_name, #supports_drop_table_if_exists?, #supports_serial?, #unique_indexes

Class Method Details

.included(base) ⇒ Object

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.



11
12
13
14
# File 'lib/dm-migrations/adapters/dm-sqlite-adapter.rb', line 11

def self.included(base)
  base.extend DataObjectsAdapter::ClassMethods
  base.extend ClassMethods
end

Instance Method Details

#field_exists?(storage_name, column_name) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
25
26
# File 'lib/dm-migrations/adapters/dm-sqlite-adapter.rb', line 22

def field_exists?(storage_name, column_name)
  table_info(storage_name).any? do |row|
    row.name == column_name
  end
end

#storage_exists?(storage_name) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/dm-migrations/adapters/dm-sqlite-adapter.rb', line 17

def storage_exists?(storage_name)
  table_info(storage_name).any?
end