Skip to main content

Creating Collection Attributes

In Appwrite Cloud, database collection attributes serve a critical role in defining the structure (schema) of the documents that are stored in a collection

Function of Collection Attributes in Appwrite Cloud

Collection attributes:

  • Define the schema (data model) of a collection.

  • Ensure data consistency by specifying what kind of data each field in a document should contain.

  • Provide validation, type enforcement, and optional default values for fields.

Attribute Types Available in Appwrite

string, integer, float, boolean, email, enum, url, ip, array, object, datetime

Must to Know

You have to create separate attributes for each collection.

1- user_profiles collection attributes

user_profiles Attributes :
  1. userId (string)
  2. name (string)
  3. user_email (string)
  4. picture (string)
  5. current_active_plan (string)
  6. is_active (boolean)
  7. char_allowed (integer)
  8. char_remaining* (integer)
  9. current_plan_start_date (datetime)
  10. current_plan_expiry_date (datetime)
  11. active_product_id (string)
  12. billing_cycle (string)
  13. plan_type (string)
  14. is_admin (boolean)
  15. creem_customer_id (string)
  16. creem_subscription_id (string)
  17. voice_clone_allowed (integer)
  18. voice_clone_used (integer)

2- user_models collection attributes

user_profiles Attributes :
  1. userId (string)
  2. fishAudioModelId (string)
  3. title (string)
  4. state (string)
  5. createdAt (string)
  6. coverImage (boolean)

3- browse_models collection attributes

user_profiles Attributes :
  1. title (string)
  2. image_url (string)
  3. fish_model_id (string)
  4. model_audio_url (string)

4- history collection attributes

user_profiles Attributes :
  1. userId (string)
  2. created_at (string)
  3. audio_url (string)

5- subscriptions collection attributes

user_profiles Attributes :
  1. user_id (string)
  2. created_at (string)
  3. current_period_start_date (string)
  4. current_period_end_date (string)
  5. plan_name (string)
  6. billing_cycle (string)
  7. status (string)
Case Sensitivity in Attribute Names

When working with the Appwrite Cloud database collections, attribute names are case-sensitive. This means that attributes like UserName, username, and USERNAME are treated as completely different fields.