[Koha-bugs] [Bug 20271] Merge deleted biblio, biblioitems, biblio_metadata, and items tables
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Tue Jan 28 10:12:06 CET 2020
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20271
--- Comment #196 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
(In reply to Tomás Cohen Arazi from comment #195)
> (In reply to Jonathan Druart from comment #193)
> > Note for myself:
> >
> > * comment 182
> >
> > * comment 183
> >
> > * comment 184
> >
> > * deal with reports
>
> This should be done using DB views. What is the 'deleted' column name we
> picked?
I wanted to try and add an automatic conversion, like we did for
biblio_metadata (bug 17898).
The column is a datetime and is named deleted_on (deleted_at in the first
patches).
> > * my $item_object = Koha::Items->find({barcode => $barcode });
> > => We need to remove the barcode unique index
>
> We need to rely on the DB to handle barcode uniqueness... we should move the
> barcode to another column, say... deleted_barcode.
If we want to keep the DBMS handle barode uniqueness we will need to discuss
how to deal with that correctly then :)
I do not like moving the column, but maybe we could add a unique constraint on
(barcode, deleted_on).
> > * Prevent regression and deal with Koha::Items->find Koha::Items->search
> > Ideas:
> > - ->find returns only non-deleted items when ->find_deleted returns only
> > deleted items
> > - same for ->search, ->search_deleted
> >
> > Or keep Koha::Old::Items that could inherit from Koha::Items
> >
> > Or update all the occurrences (how many?)
>
> On the API I would expect the endpoint to return non-deleted ones as
> default, and I would prefer to handle it explicitly: manually adding deleted
> => 0 to the query. And have ?include_deleted=true and/or ?deleted=true be
> mandatory to get the deleted ones.
>
> Maybe we could encapsulate this pattern in Koha::Objects::Deleted, which
> extended Koha::Objects with new generic methods: ->search_without_deleted
>
> I haven't made up my mind yet, but I feel it smells to have ->search have a
> weird behaviour other than the expected.
I like you idea, I will try to have a look at how we can implement it.
Also I think we will need a separate find method.
> I'm also worried how we would handle:
>
> my $items = $biblio->items;
>
> so it doesn't return deleted ones.
We deal with that already:
406 sub items {
407 my ($self) = @_;
408
409 my $items_rs = $self->_result->items->search({ deleted_on => undef });
410
411 return Koha::Items->_new_from_dbic( $items_rs );
412 }
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list