diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2014-11-16 03:08:46 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2015-02-24 01:53:54 +0900 |
commit | b8d320c1294aa582ff34e1b15782c084edc0386b (patch) | |
tree | ffbc62d8615b78e8f18c9d27b492777f9e3382f3 /activerecord/test | |
parent | e71f5dad4e0d27afbcc091173bee20bd6f4d2a4e (diff) | |
download | rails-b8d320c1294aa582ff34e1b15782c084edc0386b.tar.gz rails-b8d320c1294aa582ff34e1b15782c084edc0386b.tar.bz2 rails-b8d320c1294aa582ff34e1b15782c084edc0386b.zip |
Allow `:limit` option for MySQL bigint primary key support
Example:
create_table :foos, id: :primary_key, limit: 8 do |t|
end
# or
create_table :foos, id: false do |t|
t.column :id, limit: 8
end
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/primary_keys_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/primary_keys_test.rb b/activerecord/test/cases/primary_keys_test.rb index b45fbf0143..1ea1ef5e12 100644 --- a/activerecord/test/cases/primary_keys_test.rb +++ b/activerecord/test/cases/primary_keys_test.rb @@ -282,5 +282,15 @@ if current_adapter?(:PostgreSQLAdapter, :MysqlAdapter, :Mysql2Adapter) assert_match %r{create_table "widgets", id: :bigint}, schema end end + + if current_adapter?(:MysqlAdapter, :Mysql2Adapter) + test "primary key column type with options" do + @connection.create_table(:widgets, id: :primary_key, limit: 8, force: true) + column = @connection.columns(:widgets).find { |c| c.name == 'id' } + assert column.auto_increment? + assert_equal :integer, column.type + assert_equal 8, column.limit + end + end end end |