Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
fix: 193 (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomBursch authored Jul 10, 2023
1 parent 31a207b commit 9da7836
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions migrations/versions/c058421705ec_.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class File(DeclarativeBase):
filename = sa.Column(sa.String, primary_key=True)
created_at = sa.Column(sa.DateTime, nullable=False, default=datetime.utcnow)
updated_at = sa.Column(sa.DateTime, nullable=False, default=datetime.utcnow)
user_id = sa.Column(sa.Integer, sa.ForeignKey('user.id'), nullable=True)
created_by = sa.Column(sa.Integer, sa.ForeignKey('user.id'), nullable=True)

class Recipe(DeclarativeBase):
__tablename__ = 'recipe'
Expand Down Expand Up @@ -64,7 +64,7 @@ def upgrade():

try:
filesInUploadFolder = [f for f in listdir(UPLOAD_FOLDER) if isfile(join(UPLOAD_FOLDER, f))]
files = [File(filename=f) for f in filesInUploadFolder if not File.query.filter(File.filename == f).first()]
files = [File(filename=f) for f in filesInUploadFolder if not session.query(File.filename).filter(File.filename == f).first()]

session.bulk_save_objects(files)
session.commit()
Expand Down

0 comments on commit 9da7836

Please sign in to comment.