Remove default statement for DB
This commit is contained in:
parent
f66ee5cd7d
commit
f1411191b0
@ -51,6 +51,8 @@ async def create_link(
|
|||||||
link=link_path,
|
link=link_path,
|
||||||
owner=current_user.id,
|
owner=current_user.id,
|
||||||
redirect_link=url.url,
|
redirect_link=url.url,
|
||||||
|
expire_date=datetime.datetime.utcnow()
|
||||||
|
+ datetime.timedelta(days=30),
|
||||||
)
|
)
|
||||||
db.add(new_link)
|
db.add(new_link)
|
||||||
db.commit()
|
db.commit()
|
||||||
|
@ -68,6 +68,7 @@ def log(link, ip, user_agent):
|
|||||||
new_log = Log(
|
new_log = Log(
|
||||||
owner=owner,
|
owner=owner,
|
||||||
link=link,
|
link=link,
|
||||||
|
timestamp=datetime.datetime.utcnow(),
|
||||||
ip=ip,
|
ip=ip,
|
||||||
location=location,
|
location=location,
|
||||||
browser=browser,
|
browser=browser,
|
||||||
|
@ -24,10 +24,7 @@ class Link(Base):
|
|||||||
link = Column(String, primary_key=True)
|
link = Column(String, primary_key=True)
|
||||||
owner = Column(Integer, ForeignKey("users.id"), nullable=False)
|
owner = Column(Integer, ForeignKey("users.id"), nullable=False)
|
||||||
redirect_link = Column(String, nullable=False)
|
redirect_link = Column(String, nullable=False)
|
||||||
expire_date = Column(
|
expire_date = Column(DateTime, nullable=False)
|
||||||
DateTime,
|
|
||||||
default=datetime.datetime.utcnow() + datetime.timedelta(days=30),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class Log(Base):
|
class Log(Base):
|
||||||
@ -35,7 +32,7 @@ class Log(Base):
|
|||||||
id = Column(Integer, primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
owner = Column(Integer, ForeignKey("users.id"), nullable=False)
|
owner = Column(Integer, ForeignKey("users.id"), nullable=False)
|
||||||
link = Column(String, ForeignKey("links.link"), nullable=False)
|
link = Column(String, ForeignKey("links.link"), nullable=False)
|
||||||
timestamp = Column(DateTime, default=datetime.datetime.utcnow())
|
timestamp = Column(DateTime, nullable=False)
|
||||||
ip = Column(String, nullable=False)
|
ip = Column(String, nullable=False)
|
||||||
location = Column(String, nullable=False)
|
location = Column(String, nullable=False)
|
||||||
browser = Column(String, nullable=False)
|
browser = Column(String, nullable=False)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user