migration_3.py 617 B

123456789101112131415161718192021222324
  1. # Migration for custom system messages
  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 system_messages (
  8. room_id TEXT NOT NULL,
  9. message_id TEXT NOT NULL,
  10. user_id TEXT NOT NULL,
  11. body TEXT NOT NULL,
  12. timestamp BIGINT NOT NULL,
  13. )
  14. """
  15. )
  16. cursor.execute(
  17. "INSERT INTO migrations (id, timestamp) VALUES (3, ?)",
  18. (datetime.now(),)
  19. )
  20. conn.commit()