In my Nextcloud MySql database I see:
mysql> SELECT count(*) FROM oc_file_locks;
+----------+
| count(*) |
+----------+
| 3145 |
+----------+
1 row in set (0.00 sec)
mysql> select * from oc_file_locks LIMIT 3;
+---------+------+----------------------------------------+------------+
| id | lock | key | ttl |
+---------+------+----------------------------------------+------------+
| 1964699 | 0 | files/7aef25a3f658b21883b3e0ca3a140142 | 1726241270 |
| 1964702 | 0 | files/2d4f75e0597d74c589c6f900fd014e3b | 1726241269 |
| 1964784 | 0 | files/a2d7c6240d5bbfb529d1494588e12ec7 | 1726684205 |
+---------+------+----------------------------------------+------------+
3 rows in set (0.00 sec)
mysql> SELECT fileid, storage, path, path_hash, parent, name, size, etag FROM oc_filecache LIMIT 3;
+--------+---------+--------------+----------------------------------+--------+--------+---------+---------------+
| fileid | storage | path | path_hash | parent | name | size | etag |
+--------+---------+--------------+----------------------------------+--------+--------+---------+---------------+
| 1 | 1 | | d41d8cd98f05b204e9805998ecf8427e | -1 | | 5802024 | 66e40d7bd7b0c |
| 2 | 1 | files | 45b963397aa30d4a006330d85e4fe7a1 | 1 | files | 5802024 | 66e40d7bd7b0c |
| 3 | 1 | files/Photos | d01bb67e7371dd49fd06bad932f521c9 | 2 | Photos | 3157336 | 5c443f7c90e4e |
+--------+---------+--------------+----------------------------------+--------+--------+---------+---------------+
3 rows in set (0.00 sec)
What should look like the SQL join between these tables? i.e. what is the join clause?
e.g. this doesn’t work:
SELECT c.* FROM oc_filecache c JOIN oc_file_locks l ON l.key = concat('files/', c.path_hash) LIMIT 3;