sea-orm icon indicating copy to clipboard operation
sea-orm copied to clipboard

Be able to support Array in database

Open hf29h8sh321 opened this issue 3 years ago • 7 comments

Summary

Be able to directly support Array in database

Such as text[]

Additional Information

Right now it is represented by a custom column_type = "Custom(\"array\".to_owned())" and the type in struct is String, not Vec<T>

hf29h8sh321 avatar Mar 04 '22 02:03 hf29h8sh321

Hey @hf29h8sh321, I assumed you mean supporting Array of some permitives for PostgreSQL?

billy1624 avatar Mar 04 '22 12:03 billy1624

@billy1624 For example, Vec<String>

hf29h8sh321 avatar Mar 04 '22 15:03 hf29h8sh321

Okay, this has been discussed before

  • #151

billy1624 avatar Mar 08 '22 09:03 billy1624

This depends on https://github.com/SeaQL/sea-query/pull/225

tyt2y3 avatar Mar 31 '22 16:03 tyt2y3

Could we have an example of the workaround using Json type for the moment ? I need to store and array of enum and i can't find any example on array storage as json.

EtienneProthon avatar Jun 02 '22 06:06 EtienneProthon

Hey @EtienneProthon, please check #783

billy1624 avatar Jun 02 '22 07:06 billy1624

This is the only thing that prevents me from using sea-orm right now, because I need to work with the postgres array. I can't change the array to JSON in my tables. Is there a workaround to use an array without JSON? I'm interested in an int8 array.

negezor avatar Jun 14 '22 15:06 negezor

and array support was merged in sea-query: https://github.com/SeaQL/sea-query/pull/467 :)

kudlatyamroth avatar Oct 16 '22 15:10 kudlatyamroth

@kudlatyamroth and released)

ikrivosheev avatar Oct 16 '22 15:10 ikrivosheev

@ikrivosheev in release 0.27 info there is no mention about it :) so i assume that it was not included in 0.27, but if it is, its great news :)

kudlatyamroth avatar Oct 16 '22 18:10 kudlatyamroth

@kudlatyamroth thank! I will edit Changelog!

ikrivosheev avatar Oct 16 '22 18:10 ikrivosheev

Exciting! What is needed for sea-orm to support it now that sea-query has it?

emmiegit avatar Oct 16 '22 22:10 emmiegit

@emmiegit you can look here: https://github.com/SeaQL/sea-orm/pull/985

ikrivosheev avatar Oct 17 '22 07:10 ikrivosheev

Hey everyone, please check https://github.com/SeaQL/sea-orm/pull/1132

billy1624 avatar Oct 19 '22 14:10 billy1624