Module: DataMapper::Adapters::Sqlite3Adapter::Migration

Includes:
SQL
Included in:
DataMapper::Adapters::Sqlite3Adapter
Defined in:
lib/dm-core/adapters/sqlite3_adapter.rb

Overview

TODO: move to dm-more/dm-migrations (if possible)

Defined Under Namespace

Modules: ClassMethods, SQL

Instance Method Summary collapse

Methods included from SQL

#create_table_statement, #property_schema_statement, #sqlite_version, #supports_serial?

Instance Method Details

#field_exists?(storage_name, column_name) ⇒ Boolean

TODO: move to dm-more/dm-migrations (if possible)

Returns:

  • (Boolean)


30
31
32
33
34
# File 'lib/dm-core/adapters/sqlite3_adapter.rb', line 30

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

#storage_exists?(storage_name) ⇒ Boolean

TODO: move to dm-more/dm-migrations (if possible)

Returns:

  • (Boolean)


25
26
27
# File 'lib/dm-core/adapters/sqlite3_adapter.rb', line 25

def storage_exists?(storage_name)
  query_table(storage_name).size > 0
end