Class: Spanner::Translator::Rules::Translation::AddIndexOptions
- Inherits:
-
BaseRule
- Object
- Parser::AST::Processor
- BaseRule
- Spanner::Translator::Rules::Translation::AddIndexOptions
- Defined in:
- lib/spanner/translator/rules/translation/add_index_options.rb
Overview
- set order: { column_name: :asc, datetime: :desc } for each column on every index
- propagate name: if explicitly set on index
- propagate unique: if explicitly set on index
- add null_filtered: true if any column is nullable and index is unique: true
Constant Summary
Constants inherited from BaseRule
Instance Attribute Summary
Attributes inherited from BaseRule
Instance Method Summary collapse
Methods inherited from BaseRule
#any_index?, #capture_column_nullity, #capture_primary_key_argument, #capture_table_name, #conditionally_propagate_argument, #create_range, #initialize, #unless_seen
Constructor Details
This class inherits a constructor from Spanner::Translator::Rules::BaseRule
Instance Method Details
#on_send(node) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/spanner/translator/rules/translation/add_index_options.rb', line 14 def on_send(node) capture_column_nullity(node) return unless node.t_index? return @rewriter.remove(node.loc.expression) if Spanner::Translator.configuration.skip_indexes @rewriter.replace(node.loc.expression, "t.index #{new_arguments_for_column_definition(node)}") end |