72 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			72 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
# Data Models - Main
 | 
						|
 | 
						|
This document outlines the database models (tables) used in the Pig Farm Controller application, primarily managed by GORM.
 | 
						|
 | 
						|
## Overview
 | 
						|
 | 
						|
The `GetAllModels()` function in `internal/infra/models/models.go` provides a comprehensive list of all GORM models, which correspond to the database tables. This ensures that all necessary tables are migrated during database initialization.
 | 
						|
 | 
						|
## Database Tables
 | 
						|
 | 
						|
Below is a list of all identified database tables:
 | 
						|
 | 
						|
### Core Models
 | 
						|
 | 
						|
*   `User`
 | 
						|
*   `UserActionLog`
 | 
						|
 | 
						|
### Device Models
 | 
						|
 | 
						|
*   `Device`
 | 
						|
*   `AreaController`
 | 
						|
*   `DeviceTemplate`
 | 
						|
*   `SensorData`
 | 
						|
*   `DeviceCommandLog`
 | 
						|
 | 
						|
### Plan & Task Models
 | 
						|
 | 
						|
*   `Plan`
 | 
						|
*   `SubPlan`
 | 
						|
*   `Task`
 | 
						|
*   `PlanExecutionLog`
 | 
						|
*   `TaskExecutionLog`
 | 
						|
*   `PendingTask`
 | 
						|
*   `PendingCollection`
 | 
						|
 | 
						|
### Farm Asset Models
 | 
						|
 | 
						|
*   `PigHouse`
 | 
						|
*   `Pen`
 | 
						|
 | 
						|
### Pig & Batch Models
 | 
						|
 | 
						|
*   `PigBatch`
 | 
						|
*   `PigBatchLog`
 | 
						|
*   `WeighingBatch`
 | 
						|
*   `WeighingRecord`
 | 
						|
*   `PigTransferLog`
 | 
						|
*   `PigSickLog`
 | 
						|
 | 
						|
### Pig Buy & Sell Models
 | 
						|
 | 
						|
*   `PigPurchase`
 | 
						|
*   `PigSale`
 | 
						|
 | 
						|
### Feed Models
 | 
						|
 | 
						|
*   `RawMaterial`
 | 
						|
*   `RawMaterialPurchase`
 | 
						|
*   `RawMaterialStockLog`
 | 
						|
*   `FeedFormula`
 | 
						|
*   `FeedFormulaComponent`
 | 
						|
*   `FeedUsageRecord`
 | 
						|
 | 
						|
### Medication Models
 | 
						|
 | 
						|
*   `Medication`
 | 
						|
*   `MedicationLog`
 | 
						|
 | 
						|
### Notification Models
 | 
						|
 | 
						|
*   `Notification`
 |