This should resolve the issue in the first run where the script timestamp returns nil and the db timestamp is nil, so the db isn't initialised until the second puppet run.