Class: Cequel::Schema::UpdateTableDSL
- Inherits:
- BasicObject
- Extended by:
- Forwardable
- Defined in:
- lib/cequel/schema/update_table_dsl.rb
Overview
DSL for describing a series of schema modification statements
Class Method Summary collapse
-
.apply(updater) { ... } ⇒ void
private
Describe a series of schema modifications and build a TableUpdater to encapsulate them.
Instance Method Summary collapse
-
#add_column(name, type) ⇒ void
Add a column to the table.
-
#add_list(name, type) ⇒ void
Add a list to the table.
-
#add_map(name, key_type, value_type) ⇒ void
Add a map to the table.
-
#add_set(name, type) ⇒ void
Add a set to the table.
-
#change_column(name, type) ⇒ void
Change an existing column’s type.
-
#change_properties(options) ⇒ void
(also: #change_options)
Change one or more table storage properties.
-
#create_index(column_name, index_name = nil) ⇒ Object
(also: #add_index)
(see Cequel::Schema::TableUpdater#create_index.
-
#drop_index(index_name) ⇒ void
(also: #remove_index)
Remove a secondary index.
-
#initialize(updater) ⇒ UpdateTableDSL
constructor
private
A new instance of UpdateTableDSL.
-
#rename_column(old_name, new_name) ⇒ void
Rename a column.
Constructor Details
#initialize(updater) ⇒ UpdateTableDSL
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.
Returns a new instance of UpdateTableDSL.
29 30 31 |
# File 'lib/cequel/schema/update_table_dsl.rb', line 29 def initialize(updater) @updater = updater end |
Class Method Details
.apply(updater) { ... } ⇒ void
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.
This method returns an undefined value.
Describe a series of schema modifications and build a TableUpdater to encapsulate them
19 20 21 22 |
# File 'lib/cequel/schema/update_table_dsl.rb', line 19 def self.apply(updater, &block) dsl = new(updater) dsl.instance_eval(&block) end |
Instance Method Details
#add_column(name, type) ⇒ void
This method returns an undefined value.
Add a column to the table
37 |
# File 'lib/cequel/schema/update_table_dsl.rb', line 37 def_delegator :@updater, :add_column |
#add_list(name, type) ⇒ void
This method returns an undefined value.
Add a list to the table
43 |
# File 'lib/cequel/schema/update_table_dsl.rb', line 43 def_delegator :@updater, :add_list |
#add_map(name, key_type, value_type) ⇒ void
This method returns an undefined value.
Add a map to the table
55 |
# File 'lib/cequel/schema/update_table_dsl.rb', line 55 def_delegator :@updater, :add_map |
#add_set(name, type) ⇒ void
This method returns an undefined value.
Add a set to the table
49 |
# File 'lib/cequel/schema/update_table_dsl.rb', line 49 def_delegator :@updater, :add_set |
#change_column(name, type) ⇒ void
Changing the type of a CQL column does not modify the data currently stored in the column. Thus, client-side handling is needed to convert old values to the new type at read time. Cequel does not currently support this functionality, although it may in the future. Altering column types is not recommended.
This method returns an undefined value.
Change an existing column’s type
61 |
# File 'lib/cequel/schema/update_table_dsl.rb', line 61 def_delegator :@updater, :change_column |
#change_properties(options) ⇒ void Also known as: change_options
This method returns an undefined value.
Change one or more table storage properties
73 |
# File 'lib/cequel/schema/update_table_dsl.rb', line 73 def_delegator :@updater, :change_properties |
#create_index(column_name, index_name = nil) ⇒ Object Also known as: add_index
(see Cequel::Schema::TableUpdater#create_index
80 |
# File 'lib/cequel/schema/update_table_dsl.rb', line 80 def_delegator :@updater, :create_index |
#drop_index(index_name) ⇒ void Also known as: remove_index
This method returns an undefined value.
Remove a secondary index
87 |
# File 'lib/cequel/schema/update_table_dsl.rb', line 87 def_delegator :@updater, :drop_index |
#rename_column(old_name, new_name) ⇒ void
This method returns an undefined value.
Rename a column
67 |
# File 'lib/cequel/schema/update_table_dsl.rb', line 67 def_delegator :@updater, :rename_column |