Fix startup and init
All checks were successful
Docker Build and Publish / build (push) Successful in 6s
All checks were successful
Docker Build and Publish / build (push) Successful in 6s
This commit is contained in:
10
models.py
10
models.py
@ -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)
|
||||
|
Reference in New Issue
Block a user