database upgrading logic.