Skip to content

Commit 4a958d3

Browse files
committed
Increase data type length limit to 65536
1 parent f874a47 commit 4a958d3

5 files changed

Lines changed: 13 additions & 3 deletions

File tree

app/models/data_type.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class DataType < ApplicationRecord
1717
has_translation :display_messages, purpose: :display_message
1818
has_translation :aliases, purpose: :alias
1919

20-
validates :type, presence: true, length: { maximum: 8192 }
20+
validates :type, presence: true, length: { maximum: 65_536 }
2121
validates :definition_source, length: { maximum: 50 }
2222

2323
validate :validate_version
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# frozen_string_literal: true
2+
3+
class IncreaseTypeLimitsForDataTypesTo64kb < Code0::ZeroTrack::Database::Migration[1.0]
4+
def change
5+
remove_check_constraint :data_types, 'char_length(type) <= 8192', name: 'check_01ca31b7b9'
6+
7+
add_check_constraint :data_types, 'char_length(type) <= 65536', name: 'check_01ca31b7b9'
8+
end
9+
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
d889cbac3eeeb24a71a3983e09e0e4e88506f86288dfbbffca2108339fe03e80

db/structure.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ CREATE TABLE data_types (
168168
type text NOT NULL,
169169
definition_source text,
170170
runtime_module_id bigint NOT NULL,
171-
CONSTRAINT check_01ca31b7b9 CHECK ((char_length(type) <= 8192)),
171+
CONSTRAINT check_01ca31b7b9 CHECK ((char_length(type) <= 65536)),
172172
CONSTRAINT check_3a7198812e CHECK ((char_length(identifier) <= 50)),
173173
CONSTRAINT check_a133157a46 CHECK ((char_length(definition_source) <= 50))
174174
);

spec/models/data_type_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
describe 'validations' do
2323
it { is_expected.to validate_presence_of(:type) }
24-
it { is_expected.to validate_length_of(:type).is_at_most(8192) }
24+
it { is_expected.to validate_length_of(:type).is_at_most(65_536) }
2525
it { is_expected.to validate_length_of(:definition_source).is_at_most(50) }
2626

2727
describe '#validate_version' do

0 commit comments

Comments
 (0)