Skip to content

Commit

Permalink
Update db.py
Browse files Browse the repository at this point in the history
  • Loading branch information
pdr21001 authored Apr 23, 2025
1 parent a00fa21 commit fd5a569
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions backend/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ def init_db():
print("Database already initialized.")
return

# Connect to SQLite database (it will create the file if it doesn't exist)
conn = sqlite3.connect(db_path)
create_tables(conn)

# Insert initial data (e.g., a test animal)
cursor = conn.cursor()
cursor.execute('''INSERT INTO animals (name, species, breed, age, personality, image_path)
VALUES (?, ?, ?, ?, ?, ?)''',
('TestDog', 'Dog', 'Mixed', 2, 'Friendly', '/images/test.jpg'))
cursor.execute('''
INSERT INTO animals (name, species, breed, age, personality, image_path)
VALUES (?, ?, ?, ?, ?, ?)''',
('TestDog', 'Dog', 'Mixed', 2, 'Friendly', '/images/test.jpg'))

conn.commit()
conn.close()
Expand Down

0 comments on commit fd5a569

Please sign in to comment.