
TypeScript
export type DelayedDowngradeSchema = Models.Document & {
planFrom: PlanSchema;
planTo: PlanSchema;
effectiveDate: Date;
subscription: SubscriptionSchema;
}
TypeScript
await this.databases.createCollection(databaseId, delayedDowngradeCollectionId, "DelayedDowngrades");
await this.databases.createRelationshipAttribute(databaseId, delayedDowngradeCollectionId, planCollectionId, RelationshipType.ManyToOne, false, "planFrom");
await this.databases.createRelationshipAttribute(databaseId, delayedDowngradeCollectionId, planCollectionId, RelationshipType.ManyToOne, false, "planTo");
await this.databases.createDatetimeAttribute(databaseId, delayedDowngradeCollectionId, "effectiveDate", true);
await this.databases.createRelationshipAttribute(databaseId, delayedDowngradeCollectionId, subscriptionCollectionId, RelationshipType.OneToOne, false, "subscription");
i keep getting error ⨯ AppwriteException: Attribute with the requested key already exists. Attribute keys must be unique, try again with a different key.
i set the keys planFrom
and planTo
which are different
plans can be free/standard/professional
TL;DR
Issue: Developers are trying to create 2 relationships with the same collection but encountering an error stating that the attribute keys must be unique.
Solution: The error is due to trying to create relationships with the same key names (`planFrom` and `planTo`) pointing to the `planCollectionId`. To resolve this, ensure that the attribute keys are unique, even if they point to the same collection. Consider using different keys for the relationships despite pointing to the same collection structure.Recommended threads
- Is my approach for deleting registered u...
A few weeks ago, I was advised not to use the registered users' id in my web app. Instead, I store the publicly viewable information such as username and email ...
- Unable to create push providers - FCM or...
Currently unable to create a push provider for FCM or APNS.... https://github.com/appwrite/console/issues/2045 When uploading a file... FCM = Valid file retu...
- Stuck in "deleting"
my parent element have relationship that doesnt exist and its stuck in "deleting", i cant delete it gives me error: Collection with the requested ID could not b...
