method
new_column_from_field
v5.1.7 -
Show latest stable
- Class:
ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements
new_column_from_field(table_name, field)public
No documentation available.
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb, line 147
def new_column_from_field(table_name, field) # :nondoc:
column_name, type, default, notnull, oid, fmod, collation, comment = field
oid = oid.to_i
fmod = fmod.to_i
type_metadata = fetch_type_metadata(column_name, type, oid, fmod)
default_value = extract_value_from_default(default)
default_function = extract_default_function(default_value, default)
PostgreSQLColumn.new(
column_name,
default_value,
type_metadata,
!notnull,
table_name,
default_function,
collation,
comment: comment.presence,
max_identifier_length: max_identifier_length
)
end