From 3480e2d6dbcbd4499edc4d823dbcf7b44e1e46b2 Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Mon, 1 Dec 2025 13:32:54 +0100 Subject: [PATCH] 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. --- config/initializers/table_definition_column_limits.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/initializers/table_definition_column_limits.rb b/config/initializers/table_definition_column_limits.rb index ff01c5e3a..f604bd325 100644 --- a/config/initializers/table_definition_column_limits.rb +++ b/config/initializers/table_definition_column_limits.rb @@ -24,13 +24,13 @@ module TableDefinitionColumnLimits options[:limit] ||= STRING_DEFAULT_LIMIT end - if type == :text + if type == :text || type == :binary if options.key?(:size) size = options.delete(:size) options[:limit] ||= TEXT_SIZE_TO_LIMIT.fetch(size) do raise ArgumentError, "Unknown text size: #{size.inspect}. Use :tiny, :medium, or :long" end - else + elsif type == :text options[:limit] ||= TEXT_DEFAULT_LIMIT end end