Skip to content
Snippets Groups Projects
Unverified Commit e8c7140a authored by Jeff Evans's avatar Jeff Evans Committed by GitHub
Browse files

Fix serialization P2 issues (#17388)

* Fix serialization dump error when there are no collections

Update `select-collections` to correctly handle the case where there are no collections

Adding new test that removes all collections, then ensures that dump works with no errors

* Fix serialization load error into empty/blank target DB

Rethrowing exception in cmd when overall load fails

Add test to ensure that a dump containing a user can be loaded into a blank target app DB successfully

Adding a few missing bindings to the `with-temp-empty-app-db` code to set the connection vars under metabase.db.connection

In upsert, add hooks for a :pre-insert-fn and :post-insert-fn to be invoked for new entity instances created by the upsert process, since whether an entity will be an insert or update isn't necessarily known by the load process (only by upsert once identity-condition is checked for each)

In load, setting the pre and post insert functions for a User instance to initialize :password with a random value, and to generate and send a password reset email to the newly inserted user's email, respectively

NOTE: this post insert fn (to send a password reset email for newly inserted users) is NOT hooked up for User as of x.41 release, since it is considered a bugfix, but this can be enabled in a future release)

Adding new defs for the magic permission group names to make those easier to override from tests that might need to (such as the one added for this commit)

* Fix serialization objects being incorrectly updated on skip

Remove `maybe-fixup-card-template-ids!`, which was forcing mode :update, since the existing retry logic should cover what it was trying to do

Update Card and Metric models to delete any Dependency instances for which they are the `:model_id` (to make serialization tests after other tests created temporary Card/Dependency pairs)

Adding missing assertions for Dependency serialization

* Serialization: Fix reload entity logic

Now that the `:mode` is always respected instead of being ignored sometimes, we need to update our "second pass" reload functions to always make the mode `:update` on the second pass, or else that entity would just be skipped, which is bad

Also updated the test to use `:mode` `:skip` from the beginning to be more stringent
parent 02713dd3
No related branches found
No related tags found
No related merge requests found
Showing
with 197 additions and 62 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment