[PLAT-3409] Refactor handling of database scripts