Heh brew installation isn't the best....best to uninstall and install using NPM
Deploying a Collection with Relationships fails
Votes
0
Replies
24
Participants
Unknown
Messages
25
Rank 5: Hypervisor
After a brew reinstall appwrite, I'm now on 2.0.2
Rank 5: Hypervisor
Will try a deploy now
Rank 5: Hypervisor
Yep, that worked - I guess 1.1.1 just didn't understand relationships
Rank 5: Hypervisor
My first issue still stands, though
An attribute failed to create? If so, check the docket logs for the appwrite-worker-databases container
Rank 5: Hypervisor
No, the first issue was when deleting a collection which has an attribute with a relationship, the connected collection is not accessible
What's the error?
Rank 5: Hypervisor
500 - general_unknown
Rank 5: Hypervisor
Appwrite logs say Collection not found
Rank 5: Hypervisor
Although I tried to reproduce just now, and instead the field in the connected collection just went to undefined
I tried doing another deploy of both collections to make sure I had it set up the same way again, but that failed with ✗ Error Attribute deletion did not finish for too long.
Rank 5: Hypervisor
And all the records and attributes are gone from collection2 except the connected attribute, which is stuck at "deleting"
Rank 5: Hypervisor
OK, after starting from scratch with a new project, if collection1 gets deleted, the relationship in collection2 gets "stuck" - it can't be deleted properly, and can't be used, of course.
When creating a new record in collection2, I get the error Invalid document structure: Unknown attribute: "relationship_attribute". If I attempt to delete the relationship, the field no longer comes up when creating new documents, but that error still happens
What do the appwrite-worker-databases logs say?
Rank 5: Hypervisor
Attribute not found
[critical] (Job{v1-database} | ID: e3a51dc161ca6f876f939a590bf03771 | DatabaseV1 | <LONG JSON STRING WHICH SEEMS TO BE A REPRESENTATION OF THE COLLECTION>) has failed Utopia\Database\Exception\Structure: Invalid document structure: Unknown attribute: "relatedCollection" in /usr/src/code/vendor/utopia-php/database/src/Database/Database.php:2823
Stack trace:
#0 /usr/src/code/app/workers/databases.php(228): Utopia\Database\Database->updateDocument(Object(Utopia\Database\Document), '1_7_relationship_attribute', Object(Utopia\Database\Document))
#1 /usr/src/code/app/workers/databases.php(44): DatabaseV1->deleteAttribute(Object(Utopia\Database\Document), Object(Utopia\Database\Document), Object(Utopia\Database\Document), '64decb60069911e...')
#2 /usr/src/code/src/Appwrite/Resque/Worker.php(122): DatabaseV1->run()
#3 /usr/src/code/vendor/resque/php-resque/lib/Resque/Job.php(201): Appwrite\Resque\Worker->perform()
#4 /usr/src/code/vendor/resque/php-resque/lib/Resque/Worker.php(303): Resque_Job->perform()
#5 /usr/src/code/vendor/resque/php-resque/lib/Resque/Worker.php(242): Resque_Worker->perform(Object(Resque_Job))
#6 /usr/src/code/vendor/resque/php-resque/bin/resque(185): Resque_Worker->work('0.1', false)
#7 {main}
Rank 5: Hypervisor
Here's the collections section of my appwrite.json:
Rank 5: Hypervisor
"collections": [
{
"$id": "collection1",
"$permissions": [],
"databaseId": "relationships-test-db",
"name": "collection1",
"enabled": true,
"documentSecurity": false,
"attributes": [
{
"key": "relationship_attribute",
"type": "string",
"status": "available",
"required": true,
"array": false,
"size": 20,
"default": null
}
],
"indexes": []
},
{
"$id": "collection2",
"$permissions": [],
"databaseId": "relationships-test-db",
"name": "collection2",
"enabled": true,
"documentSecurity": false,
"attributes": [
{
"key": "relationship_attribute",
"type": "relationship",
"status": "available",
"required": false,
"array": false,
"relatedCollection": "collection1",
"relationType": "manyToOne",
"twoWay": false,
"twoWayKey": "collection2",
"onDelete": "cascade",
"side": "parent"
},
{
"key": "demo_string",
"type": "string",
"status": "available",
"required": false,
"array": false,
"size": 20,
"default": null
}
],
"indexes": []
}
]
this happened right after deleting the collection or?
Rank 5: Hypervisor
I'm not really sure when - I just went to check the logs when you asked about them. I'll go reproduce and check now
would you be able to create a github issue and in the reproduction steps, put the exat steps?
Rank 5: Hypervisor
It happened when deleting the attribute
Rank 5: Hypervisor
Can try if I remember some point next week
actually, let me see what i can do
here's the issue: https://github.com/appwrite/appwrite/issues/6012
Rank 5: Hypervisor
Thanks