mirror of
https://github.com/appwrite/appwrite
synced 2026-05-19 15:08:43 +00:00
730 B
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 });