instance method
build_create_table_definition
Ruby on Rails 7.2.3
Since v7.1.6Signature
build_create_table_definition(table_name, id: :primary_key, primary_key: nil, force: nil, **options)
Returns a TableDefinition object containing information about the table that would be created if the same arguments were passed to #create_table. See #create_table for information about passing a table_name, and other additional options that can be passed.
Parameters
-
table_namereq -
idkey = :primary_key -
primary_keykey = nil -
forcekey = nil -
optionskeyrest
Source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 336
def build_create_table_definition(table_name, id: :primary_key, primary_key: nil, force: nil, **options)
table_definition = create_table_definition(table_name, **options.extract!(*valid_table_definition_options, :_skip_validate_options))
table_definition.set_primary_key(table_name, id, primary_key, **options.extract!(*valid_primary_key_options, :_skip_validate_options))
yield table_definition if block_given?
table_definition
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb line 336
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::SchemaStatements