scripts: Do not use UNIX_TIMESTAMP

Avoid using UNIX_TIMESTAMP which is not part of the SQL standard.

See f2a6bd2 (git-interface: Do not use UNIX_TIMESTAMP, 2016-08-05) for
related changes.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Lukas Fleischer 2016-09-21 09:05:56 +02:00
parent cd2d90612b
commit 91f649f5ed
2 changed files with 9 additions and 4 deletions

View file

@ -1,14 +1,16 @@
#!/usr/bin/python3
import time
import aurweb.db
def main():
conn = aurweb.db.Connection()
limit_to = int(time.time()) - 86400
conn.execute("DELETE FROM PackageBases WHERE " +
"UNIX_TIMESTAMP() - SubmittedTS > 86400 " +
"AND PackagerUID IS NULL")
"SubmittedTS < ? AND PackagerUID IS NULL", [limit_to])
conn.commit()
conn.close()