diff --git a/src/main/resources/schema.sql b/src/main/resources/schema.sql
index 2bd7010..2018117 100644
--- a/src/main/resources/schema.sql
+++ b/src/main/resources/schema.sql
@@ -9,20 +9,20 @@
     torrent_id INT AUTO_INCREMENT PRIMARY KEY,
     user_id INT NOT NULL,
     torrent_name VARCHAR(255) NOT NULL,
-    info_hash VARCHAR(255) NOT NULL,
+    info_hash BINARY(20) NOT NULL,
     file_size FLOAT NOT NULL,
-    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
     FOREIGN KEY (user_id) REFERENCES users(user_id)
 );
 
 CREATE TABLE IF NOT EXISTS `peers` (
   user_id INT NOT NULL,
-  torrent_id INT NOT NULL,
-  peer_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+  info_hash BINARY(20) NOT NULL,
+  peer_id VARCHAR(20) NOT NULL,
   ip_address VARCHAR(128) NOT NULL,
   port INT NOT NULL,
   uploaded FLOAT NOT NULL,
   downloaded FLOAT NOT NULL,
+  last_seen TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   FOREIGN KEY (user_id) REFERENCES users(user_id),
-  FOREIGN KEY (torrent_id) REFERENCES torrents(torrent_id)
+  PRIMARY KEY (user_id, info_hash, peer_id)
 );
