Parent issue: #275
After successfully uploading a torrent you get a response like this:
{
"data": {
"torrent_id": 2561,
"info_hash": "3800bd712159f14e76519b6e4d786d6a2484d1e7", <- canonical
"original_info_hash": "3800bd712159f14e76519b6e4d786d6a2484d1e7" <- original
}
}
We decided to change the infohashes table to:
CREATE TABLE "torrust_torrent_info_hashes" (
"info_hash" TEXT NOT NULL,
"canonical_info_hash" TEXT NOT NULL,
"original_is_known" BOOLEAN NOT NULL,
PRIMARY KEY("info_hash"),
FOREIGN KEY("canonical_info_hash") REFERENCES "torrust_torrents"("info_hash") ON DELETE CASCADE
);
Where info_hash is the original info-hash (from the uploaded torrent file) and canonical_info_hash is the one we use to refer to the uploaded torrent (without non-standard info dict fields).
I think we should also rename the fields in this response:
{
"data": {
"torrent_id": 2561,
"info_hash": "3800bd712159f14e76519b6e4d786d6a2484d1e7" <- original
"canonical_info_hash": "3800bd712159f14e76519b6e4d786d6a2484d1e7", <- canonical
}
}
The problem is we use the name info_hash in the torrust_torrents::info_hash, and renaming that field would require changes in many queries.
What do you think @da2ce7?
Parent issue: #275
After successfully uploading a torrent you get a response like this:
{ "data": { "torrent_id": 2561, "info_hash": "3800bd712159f14e76519b6e4d786d6a2484d1e7", <- canonical "original_info_hash": "3800bd712159f14e76519b6e4d786d6a2484d1e7" <- original } }We decided to change the infohashes table to:
Where
info_hashis the original info-hash (from the uploaded torrent file) andcanonical_info_hashis the one we use to refer to the uploaded torrent (without non-standardinfodict fields).I think we should also rename the fields in this response:
{ "data": { "torrent_id": 2561, "info_hash": "3800bd712159f14e76519b6e4d786d6a2484d1e7" <- original "canonical_info_hash": "3800bd712159f14e76519b6e4d786d6a2484d1e7", <- canonical } }The problem is we use the name
info_hashin thetorrust_torrents::info_hash, and renaming that field would require changes in many queries.What do you think @da2ce7?