diff --git a/app/models/data_type.rb b/app/models/data_type.rb index a0432e058..d0b96a0db 100644 --- a/app/models/data_type.rb +++ b/app/models/data_type.rb @@ -17,7 +17,7 @@ class DataType < ApplicationRecord has_translation :display_messages, purpose: :display_message has_translation :aliases, purpose: :alias - validates :type, presence: true, length: { maximum: 8192 } + validates :type, presence: true, length: { maximum: 65_536 } validates :definition_source, length: { maximum: 50 } validate :validate_version diff --git a/db/migrate/20260706201844_increase_type_limits_for_data_types_to64kb.rb b/db/migrate/20260706201844_increase_type_limits_for_data_types_to64kb.rb new file mode 100644 index 000000000..c3768b5f5 --- /dev/null +++ b/db/migrate/20260706201844_increase_type_limits_for_data_types_to64kb.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class IncreaseTypeLimitsForDataTypesTo64kb < Code0::ZeroTrack::Database::Migration[1.0] + def change + remove_check_constraint :data_types, 'char_length(type) <= 8192', name: 'check_01ca31b7b9' + + add_check_constraint :data_types, 'char_length(type) <= 65536', name: 'check_01ca31b7b9' + end +end diff --git a/db/schema_migrations/20260706201844 b/db/schema_migrations/20260706201844 new file mode 100644 index 000000000..5adc26eeb --- /dev/null +++ b/db/schema_migrations/20260706201844 @@ -0,0 +1 @@ +d889cbac3eeeb24a71a3983e09e0e4e88506f86288dfbbffca2108339fe03e80 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 8ddde1a75..6ba4bf4be 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -168,7 +168,7 @@ CREATE TABLE data_types ( type text NOT NULL, definition_source text, runtime_module_id bigint NOT NULL, - CONSTRAINT check_01ca31b7b9 CHECK ((char_length(type) <= 8192)), + CONSTRAINT check_01ca31b7b9 CHECK ((char_length(type) <= 65536)), CONSTRAINT check_3a7198812e CHECK ((char_length(identifier) <= 50)), CONSTRAINT check_a133157a46 CHECK ((char_length(definition_source) <= 50)) ); diff --git a/spec/models/data_type_spec.rb b/spec/models/data_type_spec.rb index 42da68396..925703590 100644 --- a/spec/models/data_type_spec.rb +++ b/spec/models/data_type_spec.rb @@ -21,7 +21,7 @@ describe 'validations' do it { is_expected.to validate_presence_of(:type) } - it { is_expected.to validate_length_of(:type).is_at_most(8192) } + it { is_expected.to validate_length_of(:type).is_at_most(65_536) } it { is_expected.to validate_length_of(:definition_source).is_at_most(50) } describe '#validate_version' do diff --git a/spec/requests/grpc/sagittarius/module_service_spec.rb b/spec/requests/grpc/sagittarius/module_service_spec.rb index 926b8f467..22a1c2926 100644 --- a/spec/requests/grpc/sagittarius/module_service_spec.rb +++ b/spec/requests/grpc/sagittarius/module_service_spec.rb @@ -360,7 +360,7 @@ definition_data_types: [ { identifier: 'A_TYPE', - type: 'A' * 9000, + type: 'A' * 66_000, linked_data_type_identifiers: [], version: '1.0.0', definition_source: 'module-a',