# Data Models

<<MODELS_SUMMARY>>

---

## Overview

| Attribute | Value |
|-----------|-------|
| **Database Type** | <<DATABASE_TYPE>> |
| **ORM/ODM** | <<ORM_NAME>> |
| **Total Entities** | <<ENTITY_COUNT>> |
| **Schema Version** | <<SCHEMA_VERSION>> |

---

## Entity Relationship Diagram

```mermaid
erDiagram
    <<ER_DIAGRAM_CONTENT>>
```

---

## Entities Summary

| Entity | Purpose | Table/Collection | Location |
|--------|---------|------------------|----------|
<<ENTITIES_SUMMARY_TABLE>>

---

## Entity Details

### <<ENTITY_1_NAME>>

<<ENTITY_1_DESCRIPTION>>

#### Schema

| Field | Type | Constraints | Default | Description |
|-------|------|-------------|---------|-------------|
<<ENTITY_1_FIELDS_TABLE>>

#### Indexes

| Name | Fields | Type | Purpose |
|------|--------|------|---------|
<<ENTITY_1_INDEXES_TABLE>>

#### Relationships

```mermaid
erDiagram
    <<ENTITY_1_RELATIONSHIPS>>
```

| Relation | Target Entity | Type | Foreign Key |
|----------|---------------|------|-------------|
<<ENTITY_1_RELATIONS_TABLE>>

#### Validation Rules

| Field | Rule | Error Message |
|-------|------|---------------|
<<ENTITY_1_VALIDATION_TABLE>>

#### Example

```json
<<ENTITY_1_EXAMPLE>>
```

---

### <<ENTITY_2_NAME>>

<<ENTITY_2_DESCRIPTION>>

#### Schema

| Field | Type | Constraints | Default | Description |
|-------|------|-------------|---------|-------------|
<<ENTITY_2_FIELDS_TABLE>>

#### Indexes

| Name | Fields | Type | Purpose |
|------|--------|------|---------|
<<ENTITY_2_INDEXES_TABLE>>

#### Relationships

| Relation | Target Entity | Type | Foreign Key |
|----------|---------------|------|-------------|
<<ENTITY_2_RELATIONS_TABLE>>

#### Validation Rules

| Field | Rule | Error Message |
|-------|------|---------------|
<<ENTITY_2_VALIDATION_TABLE>>

#### Example

```json
<<ENTITY_2_EXAMPLE>>
```

---

## Enums & Value Types

### <<ENUM_1_NAME>>

<<ENUM_1_DESCRIPTION>>

| Value | Display Name | Description |
|-------|--------------|-------------|
<<ENUM_1_VALUES_TABLE>>

---

## Database Diagram

```mermaid
classDiagram
    <<DATABASE_CLASS_DIAGRAM>>
```

---

## Data Flow

### Create Flow

```mermaid
sequenceDiagram
    <<CREATE_FLOW_DIAGRAM>>
```

### Update Flow

```mermaid
sequenceDiagram
    <<UPDATE_FLOW_DIAGRAM>>
```

---

## Constraints

### Unique Constraints

| Entity | Fields | Name |
|--------|--------|------|
<<UNIQUE_CONSTRAINTS_TABLE>>

### Check Constraints

| Entity | Constraint | Expression |
|--------|------------|------------|
<<CHECK_CONSTRAINTS_TABLE>>

### Foreign Keys

| Source | Target | On Delete | On Update |
|--------|--------|-----------|-----------|
<<FOREIGN_KEYS_TABLE>>

---

## Migrations

### Migration History

| Version | Date | Description |
|---------|------|-------------|
<<MIGRATION_HISTORY_TABLE>>

### Running Migrations

```bash
<<MIGRATION_COMMAND>>
```

### Rollback

```bash
<<ROLLBACK_COMMAND>>
```

---

## Performance Considerations

### Query Optimization

<<QUERY_OPTIMIZATION>>

### Caching Strategy

<<CACHING_STRATEGY>>

### Partitioning

<<PARTITIONING_STRATEGY>>

---

## Data Integrity

### Soft Deletes

<<SOFT_DELETE_STRATEGY>>

### Audit Trail

<<AUDIT_TRAIL>>

### Data Retention

| Entity | Retention Period | Archive Strategy |
|--------|------------------|------------------|
<<RETENTION_TABLE>>

---

## Testing

### Factory/Fixtures

<<FACTORY_LOCATION>>

### Seeding

```bash
<<SEED_COMMAND>>
```

---

## See Also

- **Overview**: [Project Overview](../overview.md) - Domain model context
- **Flows**: [Request Flows](../flows/README.md) - Data flow through entities
- **Components**: [Components](../components/README.md) - Repository implementations
- **API**: [API Reference](../api.md) - API endpoints using these models
- **Configuration**: [Config Guide](../configuration/README.md) - Database configuration
- **Errors**: [Error Handling](../errors.md) - Validation and data errors
- **Examples**: [Usage Examples](../examples.md) - Model usage examples

---

> Generated by [Civyk Hatch DeepWiki](https://github.com/civyk-official/civyk-hatch) | Stage: 09-models | <<TIMESTAMP>>
