Handle size in binary columns
In the cable schema we use:
```
t.binary "payload", size: :long, null: false
```
This will fail when resetting the db otherwise with an error due to the unexpected size property.
This commit is contained in:
@@ -24,13 +24,13 @@ module TableDefinitionColumnLimits
|
|||||||
options[:limit] ||= STRING_DEFAULT_LIMIT
|
options[:limit] ||= STRING_DEFAULT_LIMIT
|
||||||
end
|
end
|
||||||
|
|
||||||
if type == :text
|
if type == :text || type == :binary
|
||||||
if options.key?(:size)
|
if options.key?(:size)
|
||||||
size = options.delete(:size)
|
size = options.delete(:size)
|
||||||
options[:limit] ||= TEXT_SIZE_TO_LIMIT.fetch(size) do
|
options[:limit] ||= TEXT_SIZE_TO_LIMIT.fetch(size) do
|
||||||
raise ArgumentError, "Unknown text size: #{size.inspect}. Use :tiny, :medium, or :long"
|
raise ArgumentError, "Unknown text size: #{size.inspect}. Use :tiny, :medium, or :long"
|
||||||
end
|
end
|
||||||
else
|
elsif type == :text
|
||||||
options[:limit] ||= TEXT_DEFAULT_LIMIT
|
options[:limit] ||= TEXT_DEFAULT_LIMIT
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user