Module: DataMapper::Migrations::SqlserverAdapter
- Includes:
- DataObjectsAdapter, SQL
- Defined in:
- lib/dm-migrations/adapters/dm-sqlserver-adapter.rb
Defined Under Namespace
Modules: ClassMethods, SQL
Constant Summary collapse
- DEFAULT_CHARACTER_SET =
'utf8'.freeze
Class Method Summary collapse
- .included(base) ⇒ Object private
Instance Method Summary collapse
Methods included from SQL
#character_set, #collation, #create_table_statement, #property_schema_hash, #property_schema_statement, #schema_name, #show_variable, #supports_drop_table_if_exists?, #supports_serial?
Methods included from DataObjectsAdapter
#create_model_storage, #destroy_model_storage, #dialect, #upgrade_model_storage
Methods included from DataObjectsAdapter::SQL
#alter_table_add_column_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.
13 14 15 16 |
# File 'lib/dm-migrations/adapters/dm-sqlserver-adapter.rb', line 13 def self.included(base) base.extend DataObjectsAdapter::ClassMethods base.extend ClassMethods end |
Instance Method Details
#field_exists?(storage_name, field_name) ⇒ Boolean
24 25 26 27 |
# File 'lib/dm-migrations/adapters/dm-sqlserver-adapter.rb', line 24 def field_exists?(storage_name, field_name) result = select("SELECT c.name FROM sysobjects as o JOIN syscolumns AS c ON o.id = c.id WHERE o.name = #{quote_name(storage_name)} AND c.name LIKE ?", field_name).first result ? result.field == field_name : false end |
#storage_exists?(storage_name) ⇒ Boolean
19 20 21 |
# File 'lib/dm-migrations/adapters/dm-sqlserver-adapter.rb', line 19 def storage_exists?(storage_name) select("SELECT name FROM sysobjects WHERE name LIKE ?", storage_name).first == storage_name end |