diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2016-05-31 23:15:46 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2016-05-31 23:22:07 +0900 |
commit | 706f7e9c3e2a4807e37b1a1ef21febd6444adf6f (patch) | |
tree | 5ab173d68c4598566acd1ab5af7e5d8ebf1cd42e /activerecord/lib | |
parent | 998bbbcc0e043e16b96613387cdb8f0ee4784ff2 (diff) | |
download | rails-706f7e9c3e2a4807e37b1a1ef21febd6444adf6f.tar.gz rails-706f7e9c3e2a4807e37b1a1ef21febd6444adf6f.tar.bz2 rails-706f7e9c3e2a4807e37b1a1ef21febd6444adf6f.zip |
Do not include default column limit in schema.rb
Follow up of #20815.
```ruby
class CreatePeople < ActiveRecord::Migration[5.0]
def change
create_table :people do |t|
t.integer :int
t.bigint :bint
t.text :txt
t.binary :bin
end
end
end
```
Result.
In postgresql and sqlite3 adapters:
```ruby
ActiveRecord::Schema.define(version: 20160531141018) do
create_table "people", force: :cascade do |t|
t.integer "int"
t.bigint "bint"
t.text "txt"
t.binary "bin"
end
end
```
In mysql2 adapter:
```ruby
ActiveRecord::Schema.define(version: 20160531141018) do
create_table "people", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
t.integer "int"
t.bigint "bint"
t.text "txt", limit: 65535
t.binary "bin", limit: 65535
end
end
```
After this patch:
```ruby
ActiveRecord::Schema.define(version: 20160531141018) do
create_table "people", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
t.integer "int"
t.bigint "bint"
t.text "txt"
t.binary "bin"
end
end
```
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index 44b4b547f3..718a6c5b91 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -41,14 +41,14 @@ module ActiveRecord NATIVE_DATABASE_TYPES = { primary_key: "int auto_increment PRIMARY KEY", string: { name: "varchar", limit: 255 }, - text: { name: "text" }, + text: { name: "text", limit: 65535 }, integer: { name: "int", limit: 4 }, float: { name: "float" }, decimal: { name: "decimal" }, datetime: { name: "datetime" }, time: { name: "time" }, date: { name: "date" }, - binary: { name: "blob" }, + binary: { name: "blob", limit: 65535 }, boolean: { name: "tinyint", limit: 1 }, json: { name: "json" }, } |