提交 5366cc6b 编写于 作者: R Ryuta Kamizono

Add `Column#bigint?` method

上级 1b356c2e
......@@ -86,8 +86,8 @@ def schema_creation
def column_spec_for_primary_key(column)
spec = {}
if column.auto_increment?
return unless column.limit == 8
spec[:id] = ':bigint'
spec[:id] = ':bigint' if column.bigint?
return if spec.empty?
else
spec[:id] = column.type.inspect
spec.merge!(prepare_column_options(column).delete_if { |key, _| [:name, :type, :null].include?(key) })
......
......@@ -34,6 +34,10 @@ def has_default?
!default.nil?
end
def bigint?
/bigint/ === sql_type
end
# Returns the human name of the column name.
#
# ===== Examples
......
......@@ -128,7 +128,7 @@ def schema_creation # :nodoc:
def column_spec_for_primary_key(column)
spec = {}
if column.serial?
return unless column.sql_type == 'bigint'
return unless column.bigint?
spec[:id] = ':bigserial'
elsif column.type == :uuid
spec[:id] = ':uuid'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册