activerecord-postgres-array icon indicating copy to clipboard operation
activerecord-postgres-array copied to clipboard

Fix defaults when dumping ruby schema

Open bsedat opened this issue 12 years ago • 2 comments

I noticed an issue where the schema dump contained the string version of the column default (ie "{foo,bar}"), causing errors when the schema was loaded.

I did some digging and saw that type_cast gets called to extract the default value when dumping the schema and I added a method chain to detect array columns and properly extract them.

bsedat avatar Feb 28 '13 19:02 bsedat

+1 this

lsimoneau avatar Apr 12 '13 03:04 lsimoneau

It would be great if this got merged.

We have an array field in our database with default: [], which gets garbled if we dump the schema (default: "{}"). This pull request fixes that for us.

derekkraan avatar Oct 24 '13 11:10 derekkraan