openverse-api
openverse-api copied to clipboard
Sequence deleted by ingestion server
Description
The ingestion server destroys the auto-incrementing sequence of the id key during the ingestion making it impossible to add objects from the Django admin.
Reproduction
- To see the database before ingestion, stop the
load_sample_data.shscript at line 46 usingexitand runjust init. - To see the database after ingestion, remove the
exit, comment out lines 9 to 45 and runjust init.
Screenshots
Before ingestion:
openledger=# \d audio
Table "public.audio"
Column | Type | Collation | Nullable | Default
------------------------------+--------------------------+-----------+----------+-----------------------------------
id | integer | | not null | nextval('audio_id_seq'::regclass)
After ingestion:
openledger=# \d audio
Table "public.audio"
Column | Type | Collation | Nullable | Default
------------------------------+--------------------------+-----------+----------+---------
id | integer | | not null |
Additional context
There is code for setting up a temporary sequence for the id column but the sequence does not exist on the final table.
https://github.com/WordPress/openverse-api/blob/1ed4146889fd8c455d00e8bc01417f9e62885a40/ingestion_server/ingestion_server/queries.py#L111
Resolution
- [ ] 🙋 I would be interested in resolving this bug.
This is low priority because we're not supposed to be adding media objects (audio/image) from the admin UI anyway so no actual functionality is broken.
Oh dang, thanks for finding this! Glad it's not a high priority issue at the moment.