def __init__(self, dbfile, page_rows=100):
        self.dbfile = dbfile
        self.page_rows = page_rows
        self.conn = sqlite3.connect(self.dbfile)
        self.conn.row_factory = sqlite3.Row
        cursor = self.conn.cursor()
        cursor.execute(
            "CREATE TABLE IF NOT EXISTS messages "
            "(timestamp TEXT, message TEXT);"
        )
        cursor.execute(
            "CREATE INDEX IF NOT EXISTS messages_timestamp_idx "
            "ON messages (timestamp);"
        )
        self.conn.commit()