generalizes database insert

replaces `INSERT` with `INSERT OR REPLACE` so script can be used with
existing database