Datamapper TEXT is by default limited to 65k characters. How to increase the limit?

I have a class that should have a TEXT of up to 300k characters and be stored in db PostgreSQL.

Postgres itself has no problems with megabyte blobs (I will end up storing them in S3), but Datamapper has a default limit for the characters β€œ65,000” for TEXT:

By default, DataMapper supports the following primitive types:

  • TrueClass, Boolean
  • Line
  • Text (65K character limit by default)

I want to do something like

property :id, Serial property :name, String, :index => true property :posted, DateTime property :info, DataMapper::Types::Text, :lazy => false property :data, DataMapper::Types::Text, :limit => 500000 # needs to be big is :limit correct?5 

I know that the lazy part is fine, because I got it from http://datamapper.rubyforge.org/dm-core/DataMapper/Property.html - but what keyword is used to override the limit in the TEXT field:

  • :length ?
  • :maximum ?
  • :limit ?

Or something else?

+4
source share
1 answer

OK,

Turns off: length works.

 class SomeClass include DataMapper::Resource property :id, Serial property :name, String, :index => true # strings are actively loaded property :posted, DateTime property :info, Text, :lazy => false # This is short stuff a hundred or so bytes long that I want loaded property :data, Text, :length => 500000 # Text is lazy loaded by default, but I also need to override the default length limit which is 65536 chars in DM 
+3
source

Source: https://habr.com/ru/post/1433459/


All Articles