-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
Database: Initialize xorm with an empty schema for postgres #17357
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xorm introduced some changes in go-xorm/xorm#824 and go-xorm/xorm#876 which by default will use public as the postgres schema and this was a breaking change compared to before. Grafana has implemented a custom postgres dialect so above changes wasn't a problem here. However, Grafana's custom database migration was using xorm dialect to check if the migration table exists or not. For those using a custom search_path (schema) in postgres configured on server, database or user level the migration table check would not find the migration table since it was looking in public schema due to xorm changes above. This had the consequence that Grafana's database migration failed the second time since migration had already run migrations in another schema. This change will make xorm use an empty default schema for postgres and by that mimic the functionality of how it was functioning before xorm's changes above.
marefr
requested review from
torkelo and
bergquist
and removed request for
torkelo
May 29, 2019 16:17
bergquist
reviewed
Jun 3, 2019
Co-Authored-By: Carl Bergquist <carl@grafana.com>
bergquist
approved these changes
Jun 3, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
ryantxu
added a commit
to ryantxu/grafana
that referenced
this pull request
Jun 4, 2019
* grafana/master: (49 commits) Build: specify build flag for `docker-compose up` (grafana#17411) Add a @grafana/runtime package with backendSrv interface (grafana#16533) Database: Initialize xorm with an empty schema for postgres (grafana#17357) docs: configuring custom headers in the dataproxy (grafana#17367) Explore: Queries the datasource once per run query and uses DataStreamObserver (grafana#17263) Feature: Adds redux action logging toggle from url params (grafana#17368) Build: Adds e2e tests back to master workflow with better error messages and with artifacts (grafana#17374) Explore: Handle datasources with long names better in ds picker (grafana#17393) Annotations: Improve annotation option tooltips (grafana#17384) InfluxDB: Fixes single quotes are not escaped (grafana#17398) Chore: Bump axios to 0.19.0 (grafana#17403) Alerting: golint fixes for alerting (grafana#17246) Batch disable users (grafana#17254) Chore: Remove unused properties in explore (grafana#17359) MySQL/Postgres/MSSQL: Add parsing for day, weeks and year intervals in macros (grafana#13086) Security: Prevent csv formula injection attack (grafana#17363) LDAP: remove unused function (grafana#17351) Enterprise: remove gofakeit dep (grafana#17344) Explore: Update time range before running queries (grafana#17349) Build(package.json): improve npm commands (grafana#17022) ...
ryantxu
added a commit
to ryantxu/grafana
that referenced
this pull request
Jun 4, 2019
* grafana/master: (108 commits) Build: specify build flag for `docker-compose up` (grafana#17411) Add a @grafana/runtime package with backendSrv interface (grafana#16533) Database: Initialize xorm with an empty schema for postgres (grafana#17357) docs: configuring custom headers in the dataproxy (grafana#17367) Explore: Queries the datasource once per run query and uses DataStreamObserver (grafana#17263) Feature: Adds redux action logging toggle from url params (grafana#17368) Build: Adds e2e tests back to master workflow with better error messages and with artifacts (grafana#17374) Explore: Handle datasources with long names better in ds picker (grafana#17393) Annotations: Improve annotation option tooltips (grafana#17384) InfluxDB: Fixes single quotes are not escaped (grafana#17398) Chore: Bump axios to 0.19.0 (grafana#17403) Alerting: golint fixes for alerting (grafana#17246) Batch disable users (grafana#17254) Chore: Remove unused properties in explore (grafana#17359) MySQL/Postgres/MSSQL: Add parsing for day, weeks and year intervals in macros (grafana#13086) Security: Prevent csv formula injection attack (grafana#17363) LDAP: remove unused function (grafana#17351) Enterprise: remove gofakeit dep (grafana#17344) Explore: Update time range before running queries (grafana#17349) Build(package.json): improve npm commands (grafana#17022) ...
ryantxu
added a commit
to ryantxu/grafana
that referenced
this pull request
Jun 4, 2019
* grafana/master: (142 commits) Build: specify build flag for `docker-compose up` (grafana#17411) Add a @grafana/runtime package with backendSrv interface (grafana#16533) Database: Initialize xorm with an empty schema for postgres (grafana#17357) docs: configuring custom headers in the dataproxy (grafana#17367) Explore: Queries the datasource once per run query and uses DataStreamObserver (grafana#17263) Feature: Adds redux action logging toggle from url params (grafana#17368) Build: Adds e2e tests back to master workflow with better error messages and with artifacts (grafana#17374) Explore: Handle datasources with long names better in ds picker (grafana#17393) Annotations: Improve annotation option tooltips (grafana#17384) InfluxDB: Fixes single quotes are not escaped (grafana#17398) Chore: Bump axios to 0.19.0 (grafana#17403) Alerting: golint fixes for alerting (grafana#17246) Batch disable users (grafana#17254) Chore: Remove unused properties in explore (grafana#17359) MySQL/Postgres/MSSQL: Add parsing for day, weeks and year intervals in macros (grafana#13086) Security: Prevent csv formula injection attack (grafana#17363) LDAP: remove unused function (grafana#17351) Enterprise: remove gofakeit dep (grafana#17344) Explore: Update time range before running queries (grafana#17349) Build(package.json): improve npm commands (grafana#17022) ...
ryantxu
added a commit
to ryantxu/grafana
that referenced
this pull request
Jun 4, 2019
* grafana/master: Build: specify build flag for `docker-compose up` (grafana#17411) Add a @grafana/runtime package with backendSrv interface (grafana#16533) Database: Initialize xorm with an empty schema for postgres (grafana#17357)
bergquist
added a commit
to jrockway/grafana
that referenced
this pull request
Jun 5, 2019
* master: (166 commits) Cloudwatch: Add AWS DocDB metrics (grafana#17241) Provisioning: Support folder that doesn't exist yet in dashboard provisioning (grafana#17407) Codestyle: Fix govet issues (grafana#17178) @grafana/runtime: expose location update (grafana#17428) Fix: Adds context to list of keys that are not part of query (grafana#17423) Prometheus: Correctly escape '|' literals in interpolated PromQL variables (grafana#16932) Explore: Makes it possible to use a different query field per mode (grafana#17395) DataSourceApi: remove ExploreDataSourceApi (grafana#17424) Fix: change angular loader paths (grafana#17421) Build: specify build flag for `docker-compose up` (grafana#17411) Add a @grafana/runtime package with backendSrv interface (grafana#16533) Database: Initialize xorm with an empty schema for postgres (grafana#17357) docs: configuring custom headers in the dataproxy (grafana#17367) Explore: Queries the datasource once per run query and uses DataStreamObserver (grafana#17263) Feature: Adds redux action logging toggle from url params (grafana#17368) Build: Adds e2e tests back to master workflow with better error messages and with artifacts (grafana#17374) Explore: Handle datasources with long names better in ds picker (grafana#17393) Annotations: Improve annotation option tooltips (grafana#17384) InfluxDB: Fixes single quotes are not escaped (grafana#17398) Chore: Bump axios to 0.19.0 (grafana#17403) ...
aocenas
pushed a commit
that referenced
this pull request
Jun 5, 2019
xorm introduced some changes in go-xorm/xorm#824 and go-xorm/xorm#876 which by default will use public as the postgres schema and this was a breaking change compared to before. Grafana has implemented a custom postgres dialect so above changes wasn't a problem here. However, Grafana's custom database migration was using xorm dialect to check if the migration table exists or not. For those using a custom search_path (schema) in postgres configured on server, database or user level the migration table check would not find the migration table since it was looking in public schema due to xorm changes above. This had the consequence that Grafana's database migration failed the second time since migration had already run migrations in another schema. This change will make xorm use an empty default schema for postgres and by that mimic the functionality of how it was functioning before xorm's changes above. Fixes #16720 Co-Authored-By: Carl Bergquist <carl@grafana.com> (cherry picked from commit b7a9533)
Merged
aocenas
pushed a commit
that referenced
this pull request
Jun 5, 2019
xorm introduced some changes in go-xorm/xorm#824 and go-xorm/xorm#876 which by default will use public as the postgres schema and this was a breaking change compared to before. Grafana has implemented a custom postgres dialect so above changes wasn't a problem here. However, Grafana's custom database migration was using xorm dialect to check if the migration table exists or not. For those using a custom search_path (schema) in postgres configured on server, database or user level the migration table check would not find the migration table since it was looking in public schema due to xorm changes above. This had the consequence that Grafana's database migration failed the second time since migration had already run migrations in another schema. This change will make xorm use an empty default schema for postgres and by that mimic the functionality of how it was functioning before xorm's changes above. Fixes #16720 Co-Authored-By: Carl Bergquist <carl@grafana.com> (cherry picked from commit b7a9533)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
xorm introduced some changes in
go-xorm/xorm#824 and
go-xorm/xorm#876 which by default will use
public as the postgres schema and this was a breaking change compared
to before. Grafana has implemented a custom postgres dialect so above
changes wasn't a problem here. However, Grafana's custom database
migration was using xorm dialect to check if the migration table exists
or not.
For those using a custom search_path (schema) in postgres configured on
server, database or user level the migration table check would not find
the migration table since it was looking in public schema due to xorm
changes above. This had the consequence that Grafana's database
migration failed the second time since migration had already run
migrations in another schema.
This change will make xorm use an empty default schema for postgres and
by that mimic the functionality of how it was functioning before
xorm's changes above.
Which issue(s) this PR fixes:
Fixes #16720
Special notes for your reviewer: