fix: DROP TABLE IF EXISTS before metric views (table-to-view migration)#233
Open
tingtingwan wants to merge 1 commit into
Open
fix: DROP TABLE IF EXISTS before metric views (table-to-view migration)#233tingtingwan wants to merge 1 commit into
tingtingwan wants to merge 1 commit into
Conversation
…igration Handles upgrade path from old dbdemos deployments (metrics as tables) to new version (metrics as views). Without this, existing users who previously installed the marketing campaign demo get EXPECT_VIEW_NOT_TABLE errors. Applies to: metrics_events, metrics_feedback, metrics_issues, metrics_daily_rolling Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
|
hey, this won't work I believe cause if it's a VIEW then DROP TABLE fails (as it's a view and not a table) - and vice-versa |
This file contains hidden or 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
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.
Summary
DROP TABLE IF EXISTSbefore eachCREATE OR REPLACE VIEWfor the 4 metric views:metrics_events,metrics_feedback,metrics_issues,metrics_daily_rollingEXPECT_VIEW_NOT_TABLEerror for users who previously deployed the marketing campaign demo (where these were defined as tables, not views)DROP TABLE IF EXISTSis a no-op when the table doesn't existContext
After merging PR #232 (Metric Views update), existing dbdemos users encounter:
This is because the old dbdemos defined these as tables, while the new version creates them as views.
Test plan
DROP TABLE IF EXISTSis a no-op when the object is already a view🤖 Generated with Claude Code