-
Notifications
You must be signed in to change notification settings - Fork 27
Rename fields in upload torrent response to match latest changes in the database #283
Copy link
Copy link
Closed
Labels
Code Cleanup / RefactoringTidying and Making NeatTidying and Making NeatEasyGood for NewcomersGood for Newcomers
Milestone
Description
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?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Code Cleanup / RefactoringTidying and Making NeatTidying and Making NeatEasyGood for NewcomersGood for Newcomers
Type
Projects
Status
Done