Module: EnhancedSQLite3::SupportsVirtualColumns::SchemaCreation

Defined in:
lib/enhanced_sqlite3/supports_virtual_columns.rb

Instance Method Summary collapse

Instance Method Details

#add_column_options!(sql, options) ⇒ Object



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/enhanced_sqlite3/supports_virtual_columns.rb', line 145

def add_column_options!(sql, options)
  if options[:collation]
    sql << " COLLATE \"#{options[:collation]}\""
  end

  if (as = options[:as])
    sql << " GENERATED ALWAYS AS (#{as})"

    sql << if options[:stored]
      " STORED"
    else
      " VIRTUAL"
    end
  end
  super
end