appwrite/docs/examples/1.8.x/server-deno/examples/databases/create-relationship-attribute.md
2025-08-26 15:40:03 +12:00

730 B

import { Client, Databases, RelationshipType, RelationMutate } from "https://deno.land/x/appwrite/mod.ts";

const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setKey('<YOUR_API_KEY>'); // Your secret API key

const databases = new Databases(client);

const response = await databases.createRelationshipAttribute({ databaseId: '<DATABASE_ID>', collectionId: '<COLLECTION_ID>', relatedCollectionId: '<RELATED_COLLECTION_ID>', type: RelationshipType.OneToOne, twoWay: false, // optional key: '', // optional twoWayKey: '', // optional onDelete: RelationMutate.Cascade // optional });