Exclude the default tenant table if it exists in the procedure #184
+72
−15
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.
We are using a postgreSQL procedure.
And we have a problem that when we clone a tenant, the schema name of the default tenant table is also changed.
My solution
Added pg_exclude_clone_tables parameter. (I'm not sure about the name. Change it if you need to.)
When the pg_exclude_clone_tables parameter is true, the tables specified in excluded_models are excluded from the replacements done by patch_search_path.
As a side effect, exclude tables specified in excluded_models from the clone target because the SQL output by pg_dump malfunctions if there is a create statement for the table.
Examples
Setting
apartment.rb
migration
Then create 'test' schema
Actual
Expect