From 7353c51df2d074cbe01913044bda7aeef62a31b7 Mon Sep 17 00:00:00 2001 From: Unto Markkanen Date: Sun, 3 Dec 2023 12:28:53 +0200 Subject: Modifying SQL SCHEMA to generate timestamps by itself. --- db/user.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'db/user.py') diff --git a/db/user.py b/db/user.py index a129a13..7b61fab 100644 --- a/db/user.py +++ b/db/user.py @@ -1,5 +1,3 @@ -from time import time - from sqlalchemy.sql import text class DBUser: @@ -15,12 +13,10 @@ class DBUser: def new(self, nick): sql = "INSERT \ - INTO users (nick, created) \ - VALUES (:nick, :created) \ + INTO users (nick) \ + VALUES (:nick) \ RETURNING id ;" - result = self.db.session.execute( - text(sql), { "nick":nick, "created":int(time()) } - ) + result = self.db.session.execute( text(sql), { "nick":nick } ) self.db.session.commit() return result.fetchone()[0] -- cgit v1.2.3