migration_8.py 520 B

12345678910111213141516171819202122
  1. # Migration to add settings table
  2. from datetime import datetime
  3. def migration(conn):
  4. with conn.cursor() as cursor:
  5. cursor.execute(
  6. """
  7. CREATE TABLE IF NOT EXISTS settings (
  8. setting TEXT NOT NULL,
  9. value TEXT NOT NULL,
  10. PRIMARY KEY (setting)
  11. )
  12. """
  13. )
  14. cursor.execute(
  15. "INSERT INTO migrations (id, timestamp) VALUES (8, ?)",
  16. (datetime.now(),)
  17. )
  18. conn.commit()