add flush to db