@@ -94,6 +94,17 @@ def _create_tables(self):
9494 )
9595 """ )
9696
97+ # 6. Tabla de CAJA FUERTE
98+ self .conn .execute ("""
99+ CREATE TABLE IF NOT EXISTS safe_files (
100+ id INTEGER PRIMARY KEY AUTOINCREMENT,
101+ original_path TEXT, -- Ruta original para restaurar
102+ encrypted_path TEXT, -- Dónde está ahora (visagevault_safe/...)
103+ media_type TEXT, -- 'photo' o 'video'
104+ original_date TEXT -- Para re-ordenar al restaurar
105+ )
106+ """ )
107+
97108 def _check_migrations (self ):
98109 """
99110 Verifica si la base de datos existente necesita actualizaciones de estructura
@@ -438,3 +449,18 @@ def update_drive_photo_date(self, file_id, new_iso_date):
438449 """
439450 with self .conn :
440451 self .conn .execute ("UPDATE drive_photos SET created_time = ? WHERE id = ?" , (new_iso_date , file_id ))
452+
453+ def add_to_safe (self , original_path , encrypted_path , media_type , date_str ):
454+ with self .conn :
455+ self .conn .execute ("""
456+ INSERT INTO safe_files (original_path, encrypted_path, media_type, original_date)
457+ VALUES (?, ?, ?, ?)
458+ """ , (original_path , encrypted_path , media_type , date_str ))
459+
460+ def get_safe_files (self ):
461+ cursor = self .conn .execute ("SELECT * FROM safe_files" )
462+ return cursor .fetchall ()
463+
464+ def remove_from_safe (self , encrypted_path ):
465+ with self .conn :
466+ self .conn .execute ("DELETE FROM safe_files WHERE encrypted_path = ?" , (encrypted_path ,))
0 commit comments