Drop dependent caggs materialized views.#130
Open
rapito wants to merge 3 commits intotimescale:masterfrom
Open
Drop dependent caggs materialized views.#130rapito wants to merge 3 commits intotimescale:masterfrom
rapito wants to merge 3 commits intotimescale:masterfrom
Conversation
…e with force: cascade set. + Update specs
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.
Description
This PR fetches all caggs view dependencies of a table before deleting it to drop those first and avoid a potential dependency error that is not solved automatically by
force: :cascadeChanges
schema_statementsto fetch dependent views and executedrop materialized viewon them.drop_tabletoschema_statementsand called the helper mentioned above.create_tabletoschema_statementsand called the helper mentioned above.Context
When there are nested or dependent caggregations and
create_tableordrop_tableare invoked withforce: :cascadean error is raised indicating that the object cannot be deleted because another one depends on it.This does not occur if a hyptertable has a single caggregation. But it does occur if you add a second layer and introduce another caggregation to the first one.
i.e:
events_per_hourevents_per_dayYou can see the behaviour by running this gist, or on the tests.
This causes that a migration that tries to override a table with such configuration fails.
Also, trying to run schema:load twice fails. (for whatever reason someone would need or want to do this)