# # Erminig - Fonctions relatives à la table versions # Copyright (C) 2025 L0m1g # Sous licence DOUARN - Voir le fichier LICENCE pour les détails # # Ce fichier fait partie du projet Erminig. # Libre comme l’air, stable comme un menhir, et salé comme le beurre. # from erminig.models.db import ErminigDB def insert_version_if_new(db, upstream_id, version, url): db.cursor.execute( """ SELECT id FROM versions WHERE upstream_id = ? AND version = ? """, (upstream_id, version), ) if db.cursor.fetchone(): return False # déjà en base db.cursor.execute( """ INSERT INTO versions (upstream_id, version, url) VALUES (?, ?, ?) """, (upstream_id, version, url), ) print(f"[DB] Nouvelle version insérée pour {upstream_id} : {version}") return True