Fix fefault scope to generate correct sql when using database prefix.