0.1.0 - sqlalchemy #2
@ -56,7 +56,6 @@ class WatchHistory(Base):
|
|||||||
channel_url = Column(String(255), nullable=False)
|
channel_url = Column(String(255), nullable=False)
|
||||||
channel_name = Column(String(255), nullable=False)
|
channel_name = Column(String(255), nullable=False)
|
||||||
watch_date = Column(DateTime, nullable=False, server_default=func.now())
|
watch_date = Column(DateTime, nullable=False, server_default=func.now())
|
||||||
creation_date = Column(Date, nullable=False, server_default=func.current_date())
|
|
||||||
created_by = Column(
|
created_by = Column(
|
||||||
String(100), nullable=False, server_default="mpv-youtube-queue-server"
|
String(100), nullable=False, server_default="mpv-youtube-queue-server"
|
||||||
)
|
)
|
||||||
@ -109,7 +108,9 @@ def add_video():
|
|||||||
)
|
)
|
||||||
session.add(new_entry)
|
session.add(new_entry)
|
||||||
session.commit()
|
session.commit()
|
||||||
logging.info("Data inserted into database")
|
logging.debug(
|
||||||
|
f"{video_name} by {channel_name} inserted into the database successfully"
|
||||||
|
)
|
||||||
return jsonify(message="Data added to mpv queue and database"), 200
|
return jsonify(message="Data added to mpv queue and database"), 200
|
||||||
except exc.SQLAlchemyError as e:
|
except exc.SQLAlchemyError as e:
|
||||||
session.rollback()
|
session.rollback()
|
||||||
|
Loading…
Reference in New Issue
Block a user