method

create_table

Importance_0
v5.1.7 - Show latest stable - 0 notes - Class: V5_0
create_table(table_name, options = {}) public

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/migration/compatibility.rb, line 24
        def create_table(table_name, options = {})
          if adapter_name == "PostgreSQL"
            if options[:id] == :uuid && !options.key?(:default)
              options[:default] = "uuid_generate_v4()"
            end
          end

          unless adapter_name == "Mysql2" && options[:id] == :bigint
            if [:integer, :bigint].include?(options[:id]) && !options.key?(:default)
              options[:default] = nil
            end
          end

          # Since 5.1 Postgres adapter uses bigserial type for primary
          # keys by default and MySQL uses bigint. This compat layer makes old migrations utilize
          # serial/int type instead -- the way it used to work before 5.1.
          unless options.key?(:id)
            options[:id] = :integer
          end

          if block_given?
            super do |t|
              yield compatible_table_definition(t)
            end
          else
            super
          end
        end
Register or log in to add new notes.