What problem does it solve?
This Skill helps you effectively model your database entities in Elixir applications using Ecto schemas, defining field types, associations, and embedded schemas for robust data structures. It automates the process of database schema definition.
Core Features & Use Cases
- Basic Schema Definition: Define database table structures with fields, types (string, integer, decimal, boolean, datetime, enum, map, array, binary), and
timestamps().
- Associations: Model relationships like
belongs_to, has_many, has_one, and many_to_many to connect your data entities.
- Embedded Schemas: Store nested JSON-like data directly within a parent schema, simplifying complex data structures without extra tables.
- Use Case: You're building a blog platform and need to define
Post, Comment, and User entities. Use this Skill to quickly set up their schemas, define Post has_many Comments, Comment belongs_to Post, and embed an Address schema directly into the User for billing information, ensuring data integrity and clear relationships.
Quick Start
Use the ecto-schemas skill to define an Ecto schema for a Product with fields for name (string), price (decimal), and quantity (integer).