NYPL-Simplified / server_core

Shared data model and utilities for Library Simplified server applications
7 stars 11 forks source link

Add a database index for loan's external_identifier field #1200

Closed vbessonov closed 3 years ago

vbessonov commented 4 years ago

Description

This PR adds a new database index for loans's external_identifier field.

Motivation and Context

This index is required in the case of LCP when we are not able to use a library name as a part of endpoint URLs and have to use LCP license ID (loan's external identifier) to fetch a library: loan -> patron -> library.

How Has This Been Tested?

Checklist:

vbessonov commented 4 years ago

@leonardr, I added a migration creating an index on loans.external_identifier. The example you provided was creating indices using BEGIN/EXCEPTION statements but I din't use them because I thought it's not required in this case.

leonardr commented 4 years ago

Please do add the BEGIN...EXCEPT thing. We want to make migration scripts idempotent as much as possible. Sometimes migration script suites are run multiple times if there was a crash or error during migration, and this makes it smoother.

vbessonov commented 3 years ago

@leonardr, thank you for adding the safety to code to the migration. Could we merge this PR now?