# Database Migrations

This folder contains incremental SQL files that modify the schema or seed data.
Run them in order after importing `TAFDB.sql`.

After applying migrations recreate the environment and execute the test suites:

```bash
./test_setup.sh
phpunit -c api/phpunit.xml
npm test
```

## 20250652_vehicle_form_update.sql

Updates the `Vehicles` modal definition to reference `Vehicle Registration` via the `formName` property instead of the `onClick` handler.

## 20250654_service_types_modal.sql

Adds a `Service Types` modal with an "Add Service Type" button linked to the `Service Type` form.

## 20250657_service_type_form_select_addable.sql

Updates the `Service Type` form so the `make` and `model` fields use the `select-addable` element type for vehicle lookups.

## 20250660_table_column_settings.sql

Adds a `table_column_settings` table for storing per-user hidden column preferences.

## 20250930_table_column_settings_order.sql

Adds a `column_order` field to store per-user column order preferences.

## 20251106_checkbox_table_element_type.sql

Adds a `checkbox-table` element type for capturing matrix style selections.

## 20251107_training_material_modal.sql

Creates a `Certification Tracking` modal that displays the `training_certificates` table and links to the `Training Certificate` form.

## 20251108_training_certificate_form.sql

Adds a Training Certificate form for recording employee certificates.

## 20251213_incident_trends_graph.sql

Adds an `Incident Trends` graph and modal so users can view incident counts over time with selectable time units.

## 20251224_create_safety_alert_tables.sql

Adds `safety_alerts`, `safety_alert_files`, and `safety_alert_logs` tables for managing safety alerts and their associated documents and audit history.

## 20251225_case_hours_expenses_modal.sql

Adds a `case_hours_expenses` modal for tracking case hours and expenses with date, user, and status filters.

## 20250905_jagath_deploy_changes.sql

Updates module configurations to add `client_name` to `columnsToShow` in Time Entries, Expenses, and One Time Costs tabs, and corrects `vendorName` to `vendorname` in the Case Expense form.

## 20250905_one_time_costs.sql

Adds One Time Costs functionality, including a new form, module tab, and buttons for managing one-time service costs in cases.
