Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the schema defined in the Laravel configuration #97

Merged
merged 2 commits into from
Apr 4, 2018

Conversation

grimzy
Copy link
Contributor

@grimzy grimzy commented Apr 3, 2018

PR for #96.

Possibly breaks the fix for #68 (#70) because if forces the Laravel/Laravel-postgis to use the schema set in the database configuration ('database.connections.pgsql.schema')

@coveralls
Copy link

coveralls commented Apr 3, 2018

Coverage Status

Coverage decreased (-2.3%) to 81.651% when pulling e2c786d on grimzy:master into b751206 on njbarrett:master.

@grimzy
Copy link
Contributor Author

grimzy commented Apr 3, 2018

Oops! Fixing this in a little bit.

@grimzy
Copy link
Contributor Author

grimzy commented Apr 3, 2018

FYI, the tests are not passing although the solution works as expected.
I'm not sure how to unit test a Laravel package when using the config helper and/or facade (probably have to initialize a Laravel App instance during the tests with use CreatesApplication;).

@grimzy
Copy link
Contributor Author

grimzy commented Apr 3, 2018

Pushed another commit, this time using a configuration file to set the schema to use for Postgis.

In general, I don't think that the Postgis functions should be prefixed with the schema when performing queries through Eloquent. Instead someone with the issue mentioned in #68 should try to add the alternate schema (where Postgis is loaded) to the search_path:

$schema_name = 'default_schema';
$postgis_schema = 'postgis_schema';
DB::statement("SET search_path = $schema_name, $postgis_schema");

What do you think?

@njbarrett
Copy link
Collaborator

njbarrett commented Apr 4, 2018

Thanks for this, I agree that hardcoding public was not a great solution, and think your config method is better.

I'll merge this and then see if I can assist fixing the tests.

@njbarrett njbarrett merged commit 1412576 into mstaack:master Apr 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants