Models & Tables
This guide covers everything about defining models and working with database tables in Sequelize Dart.
Overview
Models in Sequelize Dart are regular Dart classes annotated with @Table and various column annotations (like @ColumnName, @PrimaryKey, etc.). They provide a type-safe way to interact with your database tables.
Topics
- Defining Models - Learn how to create models with annotations
- Data Types - All supported SQL data types
- Table & Column Naming - Naming conventions and options
- Timestamps - Automatic timestamp management
- Column Validation - Data validation rules
- Primary Keys - Defining primary and composite keys
- Auto Increment - Auto-incrementing fields
- Nullability - Controlling null values
- Paranoid Mode (Soft Deletes) - Enable soft deletes with deletedAt timestamps
- Models Registry - Centralized model access with automatic discovery
- Complete Example - Full example with all features