instance method build_create_table_definition

Ruby on Rails 8.1.2

Since v7.1.6

Available in: v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

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_name req
id key = :primary_key
primary_key key = nil
force key = nil
options keyrest
Source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 337
      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 337 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::ConnectionAdapters::SchemaStatements

Type at least 2 characters to search.

↑↓ navigate · open · esc close