[IMP] models: when checking for data in a table, do not use column 'id'

Replace the query "SELECT min(id) FROM xxx" by "SELECT 1 FROM xxx LIMIT 1".
Both requests are as efficient, and the second one does not crash if column
'id' is missing.

Fixes #2386.