Skip to content

Commit

Permalink
DBIC::Schema::Loader tweaks
Browse files Browse the repository at this point in the history
* Use result_component_map instead of components
* Improve custom_column_info method
* Regenerate schema classes
  • Loading branch information
davorg committed Jan 15, 2016
1 parent 0184bfc commit ed6e0e5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 30 deletions.
8 changes: 6 additions & 2 deletions bin/dump_dbic
Expand Up @@ -10,7 +10,9 @@ make_schema_at(
'Lystyng::Schema', {
dump_directory => 'lib',
use_moose => 1,
components => [ 'EncodedColumn' ],
result_components_map => {
User => [ 'EncodedColumn' ],
},
custom_column_info => \&encode_password,
}, [
"dbi:mysql:dbname=$ENV{LYSTYNG_DB_NAME};host=$ENV{LYSTYNG_DB_SERVER}",
Expand All @@ -21,6 +23,8 @@ make_schema_at(
sub encode_password {
my ($table, $column_name) = @_;

return unless $table eq 'user';

if ($column_name eq 'password') {
return {
encode_column => 1,
Expand All @@ -33,4 +37,4 @@ sub encode_password {
encode_check_method => 'check_password',
};
}
}
}
16 changes: 2 additions & 14 deletions lib/Lystyng/Schema/Result/List.pm
Expand Up @@ -18,18 +18,6 @@ use MooseX::NonMoose;
use MooseX::MarkAsMethods autoclean => 1;
extends 'DBIx::Class::Core';

=head1 COMPONENTS LOADED
=over 4
=item * L<DBIx::Class::EncodedColumn>
=back
=cut

__PACKAGE__->load_components("EncodedColumn");

=head1 TABLE: C<list>
=cut
Expand Down Expand Up @@ -127,8 +115,8 @@ __PACKAGE__->belongs_to(
);


# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-01-30 20:13:57
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3eYA3YhJdL90HQRfNN07EA
# Created by DBIx::Class::Schema::Loader v0.07043 @ 2016-01-15 12:36:39
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Muyi0l0fFobj6kkf1bRP6g


# You can replace this text with custom code or comments, and it will be preserved on regeneration
Expand Down
16 changes: 2 additions & 14 deletions lib/Lystyng/Schema/Result/ListItem.pm
Expand Up @@ -18,18 +18,6 @@ use MooseX::NonMoose;
use MooseX::MarkAsMethods autoclean => 1;
extends 'DBIx::Class::Core';

=head1 COMPONENTS LOADED
=over 4
=item * L<DBIx::Class::EncodedColumn>
=back
=cut

__PACKAGE__->load_components("EncodedColumn");

=head1 TABLE: C<list_item>
=cut
Expand Down Expand Up @@ -104,8 +92,8 @@ __PACKAGE__->belongs_to(
);


# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-01-30 20:13:57
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:JdNndq1NJ/hzKunvCfj99g
# Created by DBIx::Class::Schema::Loader v0.07043 @ 2016-01-15 12:36:39
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:v3Bb+MB+Puax/tKqgmw2WQ


# You can replace this text with custom code or comments, and it will be preserved on regeneration
Expand Down

0 comments on commit ed6e0e5

Please sign in to comment.