Fix inflation of booleans from database
This commit is contained in:
parent
ebbbbd865a
commit
d5dd71661d
2 changed files with 0 additions and 22 deletions
|
@ -70,7 +70,6 @@ __PACKAGE__->belongs_to(
|
||||||
|
|
||||||
__PACKAGE__->filter_column( pending => {
|
__PACKAGE__->filter_column( pending => {
|
||||||
filter_to_storage => 'to_bool',
|
filter_to_storage => 'to_bool',
|
||||||
filter_from_storage => 'from_bool',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
# Only works when calling ->deploy, but atleast helps for tests
|
# Only works when calling ->deploy, but atleast helps for tests
|
||||||
|
@ -94,14 +93,4 @@ sub to_bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub from_bool {
|
|
||||||
my ( $self, $val ) = @_;
|
|
||||||
my $driver_name = $self->result_source->schema->storage->dbh->{Driver}->{Name};
|
|
||||||
if ( $driver_name eq 'SQLite' ) {
|
|
||||||
return $val;
|
|
||||||
} else {
|
|
||||||
return lc $val eq 'true' ? 1 : 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
@ -90,7 +90,6 @@ sub sqlt_deploy_hook {
|
||||||
|
|
||||||
__PACKAGE__->filter_column( is_admin => {
|
__PACKAGE__->filter_column( is_admin => {
|
||||||
filter_to_storage => 'to_bool',
|
filter_to_storage => 'to_bool',
|
||||||
filter_from_storage => 'from_bool',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
sub to_bool {
|
sub to_bool {
|
||||||
|
@ -103,16 +102,6 @@ sub to_bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub from_bool {
|
|
||||||
my ( $self, $val ) = @_;
|
|
||||||
my $driver_name = $self->result_source->schema->storage->dbh->{Driver}->{Name};
|
|
||||||
if ( $driver_name eq 'SQLite' ) {
|
|
||||||
return $val;
|
|
||||||
} else {
|
|
||||||
return lc $val eq 'true' ? 1 : 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub generate_session {
|
sub generate_session {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
|
|
Reference in a new issue