Files
kulakpos_web/walkthroughs/2026-05-14_b817429e_Walkthrough__Fixing_PostgreSQL_Compatibility.md

25 lines
2.0 KiB
Markdown
Raw Normal View History

2026-05-14 11:55:22 +07:00
# Walkthrough - Fixing PostgreSQL Compatibility
I have resolved the SQL errors occurring in the Loss Profit History module when running on PostgreSQL.
## Changes Made
### Business Module Controllers
- **[AcnooLossProfitHistoryController.php](file:///media/itc43/Data/OTHER_PROJECT/kulakpos/kulakpos_15Maret2026_to%20GTEA/public_html/Modules/Business/App/Http/Controllers/AcnooLossProfitHistoryController.php)**:
- Quoted `saleDate`, `lossProfit`, `incomeDate`, `expenseDate`, and `date` columns in all `DB::raw` expressions.
- Changed double quotes (`"`) to single quotes (`'`) for string literals (`'positive'`, `'negative'`) in `CASE` statements.
- **[AcnooLossProfitHistoryReportController.php](file:///media/itc43/Data/OTHER_PROJECT/kulakpos/kulakpos_15Maret2026_to%20GTEA/public_html/Modules/Business/App/Http/Controllers/AcnooLossProfitHistoryReportController.php)**:
- Applied identical fixes for PostgreSQL compatibility.
- **[AcnooProductLossProfitReportController.php](file:///media/itc43/Data/OTHER_PROJECT/kulakpos/kulakpos_15Maret2026_to%20GTEA/public_html/Modules/Business/App/Http/Controllers/AcnooProductLossProfitReportController.php)**:
- Quoted `lossProfit` in `CASE` statements.
### Export Classes
- **[ExportLossProfitHistory.php](file:///media/itc43/Data/OTHER_PROJECT/kulakpos/kulakpos_15Maret2026_to%20GTEA/public_html/Modules/Business/App/Exports/ExportLossProfitHistory.php)**:
- Fixed column quoting and string literals for Excel/CSV exports.
- **[ExportProductLossProfit.php](file:///media/itc43/Data/OTHER_PROJECT/kulakpos/kulakpos_15Maret2026_to%20GTEA/public_html/Modules/Business/App/Exports/ExportProductLossProfit.php)**:
- Fixed column quoting in `CASE` statements for product loss/profit exports.
## Verification Results
- The code changes directly address the `SQLSTATE[42703]` (Undefined column) error by ensuring PostgreSQL recognizes the mixed-case column names.
- String literal fixes prevent PostgreSQL from interpreting `'positive'` and `'negative'` as column names.