diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2014-11-26 18:54:07 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2015-09-18 20:22:32 +0900 |
commit | f3772f729c72d098156b35eb105d3ffdd928c5eb (patch) | |
tree | e08d51c076c007b14a87bf68737e45e3c69df63a /activerecord/test/cases/primary_keys_test.rb | |
parent | dcecbb4234e5b0e4751b57ce49c7afbf0775f937 (diff) | |
download | rails-f3772f729c72d098156b35eb105d3ffdd928c5eb.tar.gz rails-f3772f729c72d098156b35eb105d3ffdd928c5eb.tar.bz2 rails-f3772f729c72d098156b35eb105d3ffdd928c5eb.zip |
Add `unsigned` support for numeric data types in MySQL
Example:
create_table :foos do |t|
t.integer :unsigned_integer, unsigned: true
t.bigint :unsigned_bigint, unsigned: true
t.float :unsigned_float, unsigned: true
t.decimal :unsigned_decimal, unsigned: true, precision: 10, scale: 2
end
Diffstat (limited to 'activerecord/test/cases/primary_keys_test.rb')
-rw-r--r-- | activerecord/test/cases/primary_keys_test.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/test/cases/primary_keys_test.rb b/activerecord/test/cases/primary_keys_test.rb index 0745a37ee9..58f3dd2ac2 100644 --- a/activerecord/test/cases/primary_keys_test.rb +++ b/activerecord/test/cases/primary_keys_test.rb @@ -300,11 +300,12 @@ if current_adapter?(:PostgreSQLAdapter, :MysqlAdapter, :Mysql2Adapter) if current_adapter?(:MysqlAdapter, :Mysql2Adapter) test "primary key column type with options" do - @connection.create_table(:widgets, id: :primary_key, limit: 8, force: true) + @connection.create_table(:widgets, id: :primary_key, limit: 8, unsigned: true, 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 + assert column.unsigned? end end end |