Class: Cequel::Schema::UpdateTableDSL

Inherits:
BasicObject
Extended by:
Util::Forwardable
Defined in:
lib/cequel/schema/update_table_dsl.rb

Overview

DSL for describing a series of schema modification statements

Since:

  • 1.0.0

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Util::Forwardable

delegate

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.

Parameters:

Since:

  • 1.0.0



30
31
32
# File 'lib/cequel/schema/update_table_dsl.rb', line 30

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

Parameters:

Yields:

See Also:

  • Keyspace#update_table

Since:

  • 1.0.0



20
21
22
23
# File 'lib/cequel/schema/update_table_dsl.rb', line 20

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

Parameters:

  • name (Symbol)

    the name of the column

  • type (Symbol, Type)

    the type of the column



38
# File 'lib/cequel/schema/update_table_dsl.rb', line 38

def_delegator :@updater, :add_column

#add_list(name, type) ⇒ void

This method returns an undefined value.

Add a list to the table

Parameters:

  • name (Symbol)

    the name of the list

  • type (Symbol, Type)

    the type of the list elements



44
# File 'lib/cequel/schema/update_table_dsl.rb', line 44

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

Parameters:

  • name (Symbol)

    the name of the map

  • key_type (Symbol, Type)

    the type of the map’s keys

  • value_type (Symbol, Type)

    the type of the map’s values



56
# File 'lib/cequel/schema/update_table_dsl.rb', line 56

def_delegator :@updater, :add_map

#add_set(name, type) ⇒ void

This method returns an undefined value.

Add a set to the table

Parameters:

  • name (Symbol)

    the name of the set

  • type (Symbol, Type)

    the type of the set elements



50
# File 'lib/cequel/schema/update_table_dsl.rb', line 50

def_delegator :@updater, :add_set

#change_column(name, type) ⇒ void

Note:

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

Parameters:

  • name (Symbol)

    the name of the column

  • type (Symbol, Type)

    the new type of the column



62
# File 'lib/cequel/schema/update_table_dsl.rb', line 62

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

Parameters:

  • options (Hash)

    map of property names to new values

See Also:



74
# File 'lib/cequel/schema/update_table_dsl.rb', line 74

def_delegator :@updater, :change_properties

#create_index(column_name, index_name = nil) ⇒ Object Also known as: add_index

(see Cequel::Schema::TableUpdater#create_index



81
# File 'lib/cequel/schema/update_table_dsl.rb', line 81

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

Parameters:

  • index_name (Symbol)

    the name of the index to remove



88
# File 'lib/cequel/schema/update_table_dsl.rb', line 88

def_delegator :@updater, :drop_index

#rename_column(old_name, new_name) ⇒ void

This method returns an undefined value.

Rename a column

Parameters:

  • old_name (Symbol)

    the current name of the column

  • new_name (Symbol)

    the new name of the column



68
# File 'lib/cequel/schema/update_table_dsl.rb', line 68

def_delegator :@updater, :rename_column