AgentSkillsCN

architecting-database-schema

为 Tourly 集合定义 Schema、属性、索引与枚举。当您在 Appwrite 中设置数据库时,可使用此规则。

SKILL.md
--- frontmatter
name: architecting-database-schema
description: Defines schema, attributes, indexes, and enums for Tourly collections. Use when setting up the database in Appwrite.

Database Schema Architecture

When to use this skill

  • When creating new collections in the Appwrite Console.
  • When defining TypeScript interfaces for database documents.

Schema Definition

Users (Private Data)

  • userId (string, required)
  • name (string)
  • email (string, required)
  • role (enum: user, admin)

Tours

  • title (string, required)
  • description (markdown/text)
  • location (string, required)
  • price (float, required)
  • images (string array, storage IDs)
  • rating (float)
  • availableDates (datetime array)

Bookings

  • userId (string, required)
  • tourId (string, required)
  • status (enum: pending, confirmed, cancelled)
  • totalPrice (float)

Instructions

  • Indexes: Add indexes for searchable fields like location and price.
  • Permissions: Ensure "Users" can only read their own bookings.