Sha256: 05ef955b7f2e26504ac37ad6d15498b0f4de274fa81f03459fad61d8789b7f9f

Contents?: true

Size: 869 Bytes

Versions: 7

Compression:

Stored size: 869 Bytes

Contents

require 'cases/helper'
require 'support/schema_dumping_helper'

class PrimaryKeyBigIntTest < ActiveRecord::TestCase
  include SchemaDumpingHelper

  class Widget < ActiveRecord::Base
  end

  setup do
    @connection = ActiveRecord::Base.connection
    @connection.create_table(:widgets, id: :bigint, force: true)
  end

  teardown do
    @connection.execute("DROP TABLE IF EXISTS widgets")
  end

  test "primary key column type with bigint" do
    column = Widget.columns_hash[Widget.primary_key]
    assert_equal :integer, column.type
    assert_equal 8, column.limit
  end

  test "primary key with bigint are automatically numbered" do
    widget = Widget.create!
    assert_not_nil widget.id
  end

  test "schema dump primary key with bigint" do
    schema = dump_table_schema "widgets"
    assert_match %r{create_table "widgets", id: :bigint}, schema
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
activerecord-mysql-awesome-0.0.9 test/cases/bigint_pk_test.rb
activerecord-mysql-awesome-0.0.8 test/cases/bigint_pk_test.rb
activerecord-mysql-awesome-0.0.7 test/cases/bigint_pk_test.rb
activerecord-mysql-awesome-0.0.6 test/cases/bigint_pk_test.rb
activerecord-mysql-awesome-0.0.5 test/cases/bigint_pk_test.rb
activerecord-mysql-awesome-0.0.4 test/cases/bigint_pk_test.rb
activerecord-mysql-awesome-0.0.3 test/cases/bigint_pk_test.rb