> ## Documentation Index
> Fetch the complete documentation index at: https://ahen.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a Schema

> To create a new table you will need to create a schema file

<Steps titleSize="h3">
  <Step title="Create a Schema">
    To create table Skypydb use a schema file it expose every aspect of a table we provide an example for you to understand how to write your schema file:

    ```python Python theme={"system"}
    """
    Schema definition for Skypydb database tables.
    This file defines all tables, their columns, types, and indexes.
    """

    from skypydb.schema import defineSchema, defineTable
    from skypydb.schema.values import value

    # Define the schema with all tables
    schema = defineSchema({

        # Table for success logs
        "success": defineTable({
            "component": value.string(),
            "action": value.string(),
            "message": value.string(),
            "details": value.optional(value.string()),
            "user_id": value.optional(value.string()),
        })
        .index("by_component", ["component"])
        .index("by_action", ["action"])
        .index("by_user", ["user_id"])
        .index("by_component_and_action", ["component", "action"]),

        # Table for warning logs
        "warning": defineTable({
            "component": value.string(),
            "action": value.string(),
            "message": value.string(),
            "details": value.optional(value.string()),
            "user_id": value.optional(value.string()),
        })
        .index("by_component", ["component"])
        .index("by_action", ["action"])
        .index("by_user", ["user_id"])
        .index("by_component_and_action", ["component", "action"]),

        # Table for error logs
        "error": defineTable({
            "component": value.string(),
            "action": value.string(),
            "message": value.string(),
            "details": value.optional(value.string()),
            "user_id": value.optional(value.string()),
        })
        .index("by_component", ["component"])
        .index("by_action", ["action"])
        .index("by_user", ["user_id"])
        .index("by_component_and_action", ["component", "action"]),
    })
    ```
  </Step>
</Steps>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.