New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new set_serialize_column for DBIx::Class::Schema::Loader #1

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@fayland

fayland commented Dec 15, 2013

well, I'm using DBIx::Class::Schema::Loader to create those Result Tables.

which means I can't hack the add_columns to add the serializer_class

so instead, I add a new method to do that which I can do it after the md5sum

PACKAGE->load_components('InflateColumn::Serializer');
PACKAGE->set_serialize_column('data_column', 'JSON');

Thanks

@miquelruiz

This comment has been minimized.

Show comment
Hide comment
@miquelruiz

miquelruiz Dec 27, 2013

Owner

Hi,

This functionality can be achieved using the add_columns with a plus sign prepending the column name, as stated in the ResultSource documentation:
https://metacpan.org/pod/DBIx::Class::ResultSource#add_columns

Following your example, you could use this snippet (after the md5sum) to set the JSON serializer for "data_column":

__PACKAGE__->add_columns(
  '+data_column',
  { serializer_class => 'JSON' }
);

Please, let us know if this works for you so we can close the issue :)

Regards,
Miquel Ruiz

Owner

miquelruiz commented Dec 27, 2013

Hi,

This functionality can be achieved using the add_columns with a plus sign prepending the column name, as stated in the ResultSource documentation:
https://metacpan.org/pod/DBIx::Class::ResultSource#add_columns

Following your example, you could use this snippet (after the md5sum) to set the JSON serializer for "data_column":

__PACKAGE__->add_columns(
  '+data_column',
  { serializer_class => 'JSON' }
);

Please, let us know if this works for you so we can close the issue :)

Regards,
Miquel Ruiz

@fayland

This comment has been minimized.

Show comment
Hide comment
@fayland

fayland Dec 28, 2013

Yes. works. thanks for the tip.

fayland commented Dec 28, 2013

Yes. works. thanks for the tip.

@fayland fayland closed this Dec 28, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment