Spike: MODKBEKBJ-674 Review current database tables structure

MODKBEKBJ-674 - Getting issue details... STATUS

Purpose:

In a scope of this spike we need to review database structure, remove unused columns, possibly reorganize tables.

Not full mod-kb-ebsco-java database structure:

Unused columns and tables:

Providers, Packages, Titles, Resources.

All this objects we retrieve from EBSCO HoldingsIQ. And module did not store them until we add tag to one of them.

- Module storing records if they have tags, if tags list is empty, module will delete it.

- Module retrieve records by tags. And then request them by id from HoldingsIQ.

It looks like this 4 tables are needed just for tags. And
we using only id column. While other columns (like name, content-type) are inactive.

Table Refactoring:

I suggest to remove providers, packages, titles, resources tables. Because we already have record_id and record_type columns in tags table.
One addition is to include credentials_id column to tags


Code Refactoring:

MSEARCH-429 - Getting issue details... STATUS

We use a lot of joins to retrieve records by tags. But now we can retrieve records from one table.

  • Write databaseChangeLog script to edit database structure
  • Delete repositories related removed tables PackageRepository, ResourceRepository, TitleRepository, ProviderRepository
  • Implement logic in TagsRepository to retrieve records from tags table by TagFilter
  • Unit tests refactoring 

Changes advantages:

  • Remove unused data, simplify database structure
  • Get rid of code duplications, so searching by tag logic will be in the one class. Instead of 4 same classes
  • Will stop using SQL Joiners to improve module response time when searching by tags.