Module: EnhancedSQLite3::SupportsVirtualColumns::SchemaDumper

Defined in:
lib/enhanced_sqlite3/supports_virtual_columns.rb

Instance Method Summary collapse

Instance Method Details

#extract_expression_for_virtual_column(column) ⇒ Object



191
192
193
# File 'lib/enhanced_sqlite3/supports_virtual_columns.rb', line 191

def extract_expression_for_virtual_column(column)
  column.default_function.inspect
end

#prepare_column_options(column) ⇒ Object



179
180
181
182
183
184
185
186
187
188
189
# File 'lib/enhanced_sqlite3/supports_virtual_columns.rb', line 179

def prepare_column_options(column)
  spec = super

  if @connection.supports_virtual_columns? && column.virtual?
    spec[:as] = extract_expression_for_virtual_column(column)
    spec[:stored] = column.virtual_stored?
    spec = {type: schema_type(column).inspect}.merge!(spec)
  end

  spec
end