Skip to content

Commit

Permalink
prompt: before_first_request: After creating the table, if the table …
Browse files Browse the repository at this point in the history
…is empty, add three rows
  • Loading branch information
Codeball authored and zegl committed Aug 24, 2022
1 parent 6ca4b98 commit 1799234
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app.py
Expand Up @@ -15,6 +15,15 @@ def create_tables():
id INTEGER PRIMARY KEY AUTOINCREMENT,
description text,
done bool
c.execute("SELECT * FROM tasks")
tasks = c.fetchall()
if len(tasks) == 0:
c.execute("INSERT INTO tasks (description, done) VALUES (:description, :done)",
{"description": "Task 1", "done": 0})
c.execute("INSERT INTO tasks (description, done) VALUES (:description, :done)",
{"description": "Task 2", "done": 0})
c.execute("INSERT INTO tasks (description, done) VALUES (:description, :done)",
{"description": "Task 3", "done": 0})
)""")
conn.commit()
conn.close()
Expand Down

1 comment on commit 1799234

@vercel
Copy link

@vercel vercel bot commented on 1799234 Aug 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Someone is attempting to deploy this commit to the Codeball Team on Vercel.

To accomplish this, the commit author's email address needs to be associated with a GitHub account.

Learn more about how to change the commit author information.

Please sign in to comment.