databases_create_enum_attribute
Define an enumeration attribute in Appwrite databases to restrict field values to a predefined list of accepted options, ensuring data consistency and validation.
Instructions
Create an enumeration attribute. The elements param acts as a white-list of accepted values for this attribute.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database_id | Yes | Database ID. | |
| collection_id | Yes | Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | |
| key | Yes | Attribute Key. | |
| elements | Yes | Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long. | |
| required | Yes | Is attribute required? | |
| default | No | Default value for attribute when not provided. Cannot be set when attribute is required. | |
| array | No | Is attribute an array? |