-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
DevMode generates invalid schema: Invalid schema change (UPLOAD): destructive schema change #7253
Comments
Invalid issue. I am closing this. The issue is that the "relationship" in the local database becomes a "string" in the generated schema. EDIT: Turned out this is an issue after all. Updating the description |
Looks like all relationships in my old schema gets converted to strings in MongoDb Realm. Why is this? According to the docs here https://docs.mongodb.com/realm/sdk/react-native/fundamentals/relationships-and-embedded-objects/ it should be possible to use relationships in MongoDb Realm. The way it works now is unintuitive. Do I need to change the schema manually? |
I think I figured out what is happening here. All "relationships" in embedded objects are automatically changed from a relationship to a string in the Atlas schema when using devmode. This makes sync fail with "Invalid schema change (UPLOAD): destructive schema change". I assume this is a bug? That the relationship that exists in the models should generate a relationship in Atlas as well? Models I used are the same as the ones I posed in the sample for #7145 and #7248 |
More weirdness. The schema in atlas actually contains all the relationships, but the generated swift classes have converted all relationships in EmbeddedObject classes to plain strings. Not sure what is going on here. |
Hi @sipersso Can you please share your Atlas schema definition, so I can help you with this issue? |
@dianaafanador3 I am not able to share it here, but I have uploaded it to the support portal (ticket 00771573) and asked them to forward it to you and added contact details if you need any more input. |
Hello @sipersso , I got everything I needed for testing it out, I'll let you know if I'm able to solve this as soon as possible. |
Hmm... I actually managed to remove the property that caused the invalid schema. It was not necessary to have this in the sync schema and now the sync has actually started working. I am still not sure why this has started working, but it does. |
Hi @sipersso given your last comment, are you ok to now close this issue? |
Yes, I have verified that the sync work after turning dev mode off. Closing the issue. |
Goals
Create a synced schema based on a current local realm schema. The schema contains relationships
Expected Results
When running MongoDb Realm in devmode, the schema should be generated correctly.
Actual Results
Sync fails since it says that it is an invalid schema change.
"Sync: Connection[2]: Session[2]: Received: ERROR "Invalid schema change (UPLOAD): destructive schema change: cannot change field "deletedPropertyName" in table "AnObject" from "string" to a relationship" (error_code=225, try_again=0)"
It looks like all relationships in the generated schema is of type "string" instead of relationship and this will cause sync to fail even though I am running the app in dev mode with the goal of generating a schema
Steps for others to Reproduce
1: Create an realm schema containing a relationship
2: Run MongoDb Realm in devmode
Version of Realm and Tooling
Realm framework version: 10.7.5
The text was updated successfully, but these errors were encountered: