If your Lumia's Windows 10 version is 1703 or lower, you can extract messages.db through this procedure otherwise use this other one