Les choses sérieuses commencent
This commit is contained in:
parent
7a9fe18463
commit
c63f62721b
41 changed files with 1270 additions and 0 deletions
25
erminig/models/versions.py
Normal file
25
erminig/models/versions.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue