Latest Updates

Documenting code, one commit at a time.

Chat PHP 10 posts
×

Refactoring Data Access in Reimpact Platform: Removing Redundant Relationships

Introduction

The Reimpact platform is undergoing continuous improvements to enhance its data model and overall efficiency. One recent focus has been on refining relationships between models to ensure data integrity and reduce redundancy.

The Challenge

In a recent update, a specific issue was identified within the LatestMassiveUploadsWidget. The MassiveUpload model, designed for

Read more

Recovering PostgreSQL Report Functions in Laravel

Introduction

When performing database migrations, especially in multi-tenant environments, it's crucial to ensure all aspects of the schema are correctly applied to each tenant. This post explores a scenario in a Laravel application where PostgreSQL functions were unintentionally dropped during a tenant migration and how they were recovered.

The Problem: Silently Missing Functions

Read more
PHP PostgreSQL

Seeding PostgreSQL: Avoiding SQL Escaping Issues

When working with databases, especially PostgreSQL, ensuring data integrity during the seeding process is crucial. A common pitfall involves SQL escaping issues, particularly when dealing with special characters within string values.

The Problem: Escaping Hell in Seed Migrations

Initial attempts to populate a database often involve seed migrations. These migrations contain SQL statements to

Read more

Multi-Tenancy Done Right: Tenant-Specific Database Tables

When building a multi-tenant application with Laravel and PostgreSQL, handling data isolation is crucial. One effective approach is to use separate database schemas for each tenant. This provides a high level of isolation, ensuring that data from different tenants remains completely separate. Let's explore how this works in practice within the Reimpact platform.

The Problem: Shared Tables

Read more

Improving Error Handling in the Reimpact/platform Project

This post details improvements to error handling within the Reimpact/platform project, focusing on delete operations and providing more specific and informative error messages.

The Problem

Previously, the platform had a generic catch-all for delete errors. This made it difficult to distinguish between expected errors, such as foreign key violations, and unexpected errors, hindering debugging

Read more

Ensuring Data Integrity: Restoring Global Rates in a Laravel Application

Introduction

Maintaining data accuracy across all tenants in a multi-tenant application can be challenging. This post explores how to correct an issue where global rates were inadvertently made tenant-specific in a Laravel application, impacting data integrity.

The Problem: Tenant-Scoped Rates

Originally, the rates table was intended to store global rates applicable to all tenants.

Read more

Tenant Context Troubles: Debugging Queue Deserialization in a Multi-Tenant Laravel App

In the Reimpact/platform project, we encountered a tricky issue with queue deserialization in our multi-tenant environment. This post details the problem, our investigation, and the solution we implemented.

The Problem

Our application uses a queue to generate reports. A GenerateReportJob is dispatched, serializing the GeneratedReport model.

Read more

Handling Large Uploads and Improving Error Notifications in a Filament Application

When working with the Reimpact/platform project, we encountered an issue with large upload deletions that resulted in failures and an unhelpful JSON response. This post describes how we resolved the deletion failure and improved the user experience by displaying a Filament notification instead of a raw JSON page.

The Problem

Deleting a large number of generated reports and calculated data

Read more

Handling Tenant Database Schema Updates in Laravel

When developing multi-tenant applications with Laravel, managing database schema updates across tenants can be tricky. This post discusses how to address a common issue: ensuring that all tenant databases have the necessary schema changes after migrations.

The Problem: Missing Columns After Migration

In a multi-tenant Laravel application, each tenant typically has its own database schema.

Read more