Class: CouchbaseOrm::IndexMigration::Operations::CreateIndex
- Inherits:
-
Object
- Object
- CouchbaseOrm::IndexMigration::Operations::CreateIndex
- Defined in:
- lib/couchbase-orm/index_migration/operations.rb
Instance Attribute Summary collapse
-
#index_definition ⇒ Object
readonly
Returns the value of attribute index_definition.
Instance Method Summary collapse
- #execute(migration) ⇒ Object
-
#initialize(index_definition) ⇒ CreateIndex
constructor
A new instance of CreateIndex.
- #inverse ⇒ Object
Constructor Details
#initialize(index_definition) ⇒ CreateIndex
Returns a new instance of CreateIndex.
9 10 11 |
# File 'lib/couchbase-orm/index_migration/operations.rb', line 9 def initialize(index_definition) @index_definition = index_definition end |
Instance Attribute Details
#index_definition ⇒ Object (readonly)
Returns the value of attribute index_definition.
7 8 9 |
# File 'lib/couchbase-orm/index_migration/operations.rb', line 7 def index_definition @index_definition end |
Instance Method Details
#execute(migration) ⇒ Object
13 14 15 |
# File 'lib/couchbase-orm/index_migration/operations.rb', line 13 def execute(migration) migration.execute_query(migration.query_builder.create_index(index_definition)) end |
#inverse ⇒ Object
17 18 19 |
# File 'lib/couchbase-orm/index_migration/operations.rb', line 17 def inverse RemoveIndex.new(index_definition.name) end |