Latest Updates

Documenting code, one commit at a time.

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

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

Evolving Data Structures in Platform Notifications

The platform project is undergoing continuous improvement to enhance its notification system.

The Challenge: Data Structure Evolution

Initially, the notification system stored data in a simple text column. However, as the platform evolved, the need for richer, structured data within notifications became apparent. This required a transition to a more flexible data type.

The Solution:

Read more

Enhancing Database Interactions in Reimpact Platform with Notifications and Error Handling

The Reimpact platform is focused on streamlining various business processes. Recent updates enhance the platform's interaction with databases, specifically focusing on user notifications and improved error handling for foreign key violations in both MySQL and PostgreSQL.

Database Notifications

A key improvement involves enabling database notifications within Filament panels.

Read more

Tenant Schema Resetting Too Early: A Laravel Livewire Gotcha

The Reimpact/platform project focuses on providing a multi-tenant application structure. Recently, we encountered an issue with tenant database schemas being reset prematurely during Livewire updates. This post dives into the problem and the solution implemented.

The Problem

In a multi-tenant application, each tenant typically has its own database schema. We use middleware to set the correct

Read more

Tenant Schema Optimization in Reimpact Platform's Packaging Module

The Reimpact platform is undergoing continuous improvements to enhance its multi-tenancy capabilities. Recent work focuses on optimizing database queries within the Packaging module, ensuring data isolation and preventing errors in tenant-specific schemas.

The Problem

In a multi-tenant environment, each tenant operates within its own schema. The Packaging module, responsible for managing

Read more

Simplifying Tenant Management in Reimpact Platform

The Challenge

In multi-tenant applications, managing data isolation is crucial. The Reimpact platform, designed for managing various industrial processes, initially relied on company_id filtering within each database table to achieve this isolation. This approach, while functional, introduced redundancy and complexity across our Eloquent models.

The Solution: PostgreSQL Schema Isolation

Read more

Enhancing Tenant Management and File Handling in Laravel Applications

Introduction

When building multi-tenant applications with Laravel, ensuring proper tenant context and efficient file handling are critical. Recent updates to the Reimpact platform focus on improving these aspects, streamlining tenant schema management and simplifying large file uploads.

Tenant Schema Isolation Improvements

Proper tenant schema isolation is essential for maintaining data

Read more