method

new_column_from_field

Importance_0
v7.0.0 - Show latest stable - 0 notes - Class: SchemaStatements
new_column_from_field(table_name, field) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb, line 129
          def new_column_from_field(table_name, field)
            default =                case field["dflt_value"]
              when /^null$/
                nil
              when /^'(.*)'$/
                $1.gsub("''", "'")
              when /^"(.*)"$/
                $1.gsub('""', '"')
              else
                field["dflt_value"]
              end

            type_metadata = fetch_type_metadata(field["type"])
            Column.new(field["name"], default, type_metadata, field["notnull"].to_i == 0, collation: field["collation"])
          end
Register or log in to add new notes.