Fix startup and init
All checks were successful
Docker Build and Publish / build (push) Successful in 6s

This commit is contained in:
2024-11-05 15:03:32 -05:00
parent 6f2ecd9775
commit 905e3c3977
3 changed files with 76 additions and 90 deletions

View File

@ -22,5 +22,13 @@ class Photo(Base):
unique_key = Column(String(16), nullable=False) # Add this line
engine = create_engine('sqlite:///photos.db')
Base.metadata.create_all(engine)
def init_db():
try:
Base.metadata.create_all(engine)
except Exception as e:
# Tables already exist, skip creation
pass
init_db()
Session = sessionmaker(bind=engine)