Sha256: 672686dd7d2c01d338cd4233ca98d8ecd43fbe5d9f93165752cc570b7818592c
Contents?: true
Size: 1.09 KB
Versions: 4
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" class Mysql2AutoIncrementTest < ActiveRecord::Mysql2TestCase include SchemaDumpingHelper def setup @connection = ActiveRecord::Base.connection end def teardown @connection.drop_table :auto_increments, if_exists: true end def test_auto_increment_without_primary_key @connection.create_table :auto_increments, id: false, force: true do |t| t.integer :id, null: false, auto_increment: true t.index :id end output = dump_table_schema("auto_increments") assert_match(/t\.integer\s+"id",\s+null: false,\s+auto_increment: true$/, output) end def test_auto_increment_with_composite_primary_key @connection.create_table :auto_increments, primary_key: [:id, :created_at], force: true do |t| t.integer :id, null: false, auto_increment: true t.datetime :created_at, null: false end output = dump_table_schema("auto_increments") assert_match(/t\.integer\s+"id",\s+null: false,\s+auto_increment: true$/, output) end end
Version data entries
4 entries across 4 versions & 1 rubygems