Afrostream / afrostream-back-end

Simple backo for afrostream
1 stars 0 forks source link

database pf: duplicate md5Hash #395

Open syndr0m opened 7 years ago

syndr0m commented 7 years ago

for the reccord, on change e8812a69d80cda044cf5ae607708d022

select count(contentId) as c, md5Hash from contents group by md5Hash having c > 1 order by c desc;

result :

mysql> select count(contentId) as c, md5Hash from contents group by md5Hash having c > 1 order by c desc;
+---+----------------------------------+
| c | md5Hash                          |
+---+----------------------------------+
| 2 | 19b45e5f9428d1cd4c1a01042a2ad4f8 |
| 2 | 74c4934e80c08953ff25ef3dc7d093a1 |
| 2 | dbe8cddb5a3d955cecb3162c0305f922 |
| 2 | 8e18aead845dd61dffef3892ba0162e7 |
| 2 | a2085bd677b3ba7a87fe7eda68e92660 |
| 2 | ea11a7df941d3252a06e1cab050f3e55 |
| 2 | ff0d53cada2fb58fcf5bdaf75f04b733 |
| 2 | 44f931210d6387cc18317821da9956e3 |
| 2 | 628b4ffa233324397f529b309e11bf2b |
| 2 | 30fc7fc063302dfa2df19d37506224af |
+---+----------------------------------+

on traite spécifiquement un cas, on renomme le md5Hash du contenu n'étant pas le bon peut être faudrait il effacer ce content au lieu de renommer le md5Hash

mysql> select * from contents where contentId=12833;
+-----------+--------------------------------------+----------------------------------+-------------------------------------------------------+-------+------------+----------+------------+----------+---------------------+---------------------+
| contentId | uuid                                 | md5Hash                          | filename                                              | state | size       | duration | uspPackage | drm      | createdAt           | updatedAt           |
+-----------+--------------------------------------+----------------------------------+-------------------------------------------------------+-------+------------+----------+------------+----------+---------------------+---------------------+
|     12833 | 607b6912-3c9c-48fa-83f5-7701ec484352 | e8812a69d80cda044cf5ae607708d022 | /space/videos/sources/tylerperry_fbow_s03ep16_bis.mp4 | ready | 1529751042 | 00:20:19 | disabled   | disabled | 2017-02-01 11:16:19 | 2017-02-01 14:39:32 |
+-----------+--------------------------------------+----------------------------------+-------------------------------------------------------+-------+------------+----------+------------+----------+---------------------+---------------------+
1 row in set (0.00 sec)

mysql> UPDATE contents SET md5Hash='00000000d80cda044cf5ae607708d022' where contentId=12833;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0