openverse-api icon indicating copy to clipboard operation
openverse-api copied to clipboard

Sequence deleted by ingestion server

Open dhruvkb opened this issue 3 years ago • 2 comments

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.sh script at line 46 using exit and run just init.
  • To see the database after ingestion, remove the exit, comment out lines 9 to 45 and run just 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.

dhruvkb avatar Mar 31 '22 07:03 dhruvkb

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.

dhruvkb avatar Mar 31 '22 07:03 dhruvkb

Oh dang, thanks for finding this! Glad it's not a high priority issue at the moment.

AetherUnbound avatar Apr 01 '22 17:04 AetherUnbound