database script refactor
mergefix