Add guard condition to database initializer