diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2016-03-07 06:25:54 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2016-03-11 14:44:36 +0900 |
commit | 37024ce479676bbb338d4083dbc31f34a1eca893 (patch) | |
tree | fce163d29f3bd85e871f45b8630c45e5cc2c9eb6 /activerecord/lib | |
parent | a101115d5b8011278891f30f69901f9583ea7685 (diff) | |
download | rails-37024ce479676bbb338d4083dbc31f34a1eca893.tar.gz rails-37024ce479676bbb338d4083dbc31f34a1eca893.tar.bz2 rails-37024ce479676bbb338d4083dbc31f34a1eca893.zip |
Dump `bigint` instead of `integer` with `limit: 8` for schema dumper
Before:
```ruby
create_table "big_numbers", force: :cascade do |t|
t.integer "bigint_column", limit: 8
end
```
After:
```ruby
create_table "big_numbers", force: :cascade do |t|
t.bigint "bigint_column"
end
```
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb | 8 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb index 2209874d0a..9e653cd7c4 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb @@ -57,11 +57,15 @@ module ActiveRecord private def schema_type(column) - column.type + if column.bigint? + :bigint + else + column.type + end end def schema_limit(column) - limit = column.limit + limit = column.limit unless column.bigint? limit.inspect if limit && limit != native_database_types[column.type][:limit] end diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb index 5cb2bbbf18..19761618cf 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb @@ -41,10 +41,6 @@ module ActiveRecord end end - def schema_limit(column) - super unless schema_type(column) == :bigserial - end - def schema_expression(column) super unless column.serial? end |