Software
Your Local Database Is Lying to You: Dev–Prod Parity Lessons
MariaDB vs MySQL, timezones and empty folders — small differences that break real deployments.
"Works on my machine" is a cliché because it keeps happening. The modern version is "works on my machine and passes in CI" — and still breaks somewhere else, because the three environments involved are subtly different.
The Twelve-Factor App calls the goal dev–prod parity: keep development, testing and production as similar as possible. Here are the specific gaps that caused real failures while building and deploying a Laravel application — and how to close each one.
"MySQL-compatible" isn't identical
Many developers use MariaDB locally — it ships with XAMPP and plenty of Linux distributions — while CI images and cloud services often default to MySQL 8. They speak the same protocol and run the same SQL most of the time, which is exactly why the differences are dangerous.
Strictness: integers compared with dates
A cleanup command deleted old rows from Laravel's jobs table with a condition like created_at < '2026-11-17 09:31:17'. That column isn't a datetime: Laravel stores queue timestamps as integer Unix timestamps.
Locally, the database coerced the string and carried on quietly. MySQL 8 in CI refused with "Truncated incorrect INTEGER value." The local behaviour was arguably worse: the query ran, compared nonsense, and could have deleted the wrong rows in production.
The fix in code was simple: compare against now()->subDay()->getTimestamp(). The lesson was broader: several framework tables — queue jobs, job batches, sessions, cache — store integer timestamps. Check column types before writing time-based queries.
JSON: key order isn't guaranteed
A test stored a menu as JSON, read it back and asserted it was identical to [['label' => 'Owner link', 'url' => '/owner']]. It passed locally and failed in CI.
MySQL stores JSON in a binary format and normalises object key order. MariaDB stores JSON as text and preserves insertion order. The data was identical; the order of keys in the decoded array wasn't, and a strict identity comparison noticed.
Two fixes: compare decoded JSON order-insensitively in tests, and make sure application code never depends on key order inside JSON documents.
The real fix: test on the production engine
Once the hosting turned out to run MariaDB 11.8, the CI database service was switched to the same engine and version, and local tests moved to a matching portable install. Since then, the differences surface on the developer's machine instead of in a failed deploy.
If you can't match versions exactly, at least match the engine and run your CI against what production actually runs.
Timezones: store in UTC, display locally
A request to show schedules in Indian Standard Time led to a seemingly harmless change: set the application timezone to Asia/Kolkata.
On a live database, that would have been a disaster. Most frameworks store datetimes without timezone information, interpreted in the application's timezone. Every existing row had been written in UTC. Changing the app timezone would have silently reinterpreted all of them as IST — shifting every publish date, schedule and log entry by five and a half hours.
The robust pattern:
- Store everything in UTC. Keep the application timezone UTC forever.
- Convert on input: date pickers accept local time and convert to UTC before saving.
- Convert on output: a single helper formats dates in the display timezone for humans.
- Keep machine formats explicit: sitemaps, feeds, structured data and
<time datetime>attributes use ISO 8601 with an offset.
Test it with a round trip: schedule something for 09:30 IST, confirm it's stored as 04:00 UTC, published at 04:00 UTC, and displayed as 09:30 IST.
The filesystem: what git doesn't carry
Tests passed locally and failed on the first CI run with "Test directory tests/Unit not found." The folder existed on the developer's machine — empty. Git doesn't track empty directories, so CI never received it.
Now every phase is verified the way CI builds it: clone into a fresh directory, install dependencies from the lockfile, build assets, copy the example environment file, generate a key and run the full suite. A fresh clone catches untracked files, missing environment variables and assets that only exist locally.
The runtime: PHP versions and extensions
Different PHP binaries on one machine caused their own confusion. One installation lacked the intl extension, so composer install refused to proceed, while the agent had silently been using another binary that had it.
Pin your platform in composer.json (config.platform.php) to the production version, list required extensions explicitly, and check php -v and php -m on every machine — including the production server's command-line PHP, which isn't always the same as its web PHP.
The server: things no test suite can see
Some differences only exist on the real host: disabled functions, cron formats, symlink restrictions, proxy headers, mail server behaviour. You can't unit-test your way out of these.
What helps:
- A production readiness command that checks configuration on the live server — debug mode off, HTTPS URL, secure cookies, mail configured, real CAPTCHA keys.
- A staged first deploy, where you expect failures and verify each piece manually.
- Recording every discovery as a written constraint, so future code doesn't repeat the mistake.
A parity checklist
- Same database engine and major version in dev, CI and production
- Application timezone UTC everywhere; local time only at the edges
- CI builds from a fresh clone, exactly like a deploy
- PHP version pinned; required extensions listed and checked
- Production quirks documented as constraints
- A readiness check you run after every deploy
None of this is glamorous. All of it is cheaper than a 2 a.m. debugging session caused by a difference you didn't know existed.
Related reading: Laravel queues and cron on shared hosting · How to brief an AI coding agent safely
Frequently asked questions
What is dev–prod parity?
It's the practice of keeping development, testing and production environments as similar as possible — same database engine, runtime versions, extensions and configuration — so code that works in one works in all.
Are MariaDB and MySQL fully compatible?
Mostly, but not completely. They differ in areas such as JSON storage and key ordering, default strictness and some functions, which is why tests should run on the same engine as production.
Should I store dates in UTC or local time?
Store in UTC and keep the application timezone UTC. Convert to the user's or site's local timezone only when displaying dates or accepting input.
Why do my tests pass locally but fail in CI?
Usually environment drift: an untracked file or empty folder, a different database version, missing environment variables or a different PHP version. Reproduce CI with a fresh clone.
Related
Software
Windows 10 ESU Now Runs to October 2027: How to Check Your PC Is Enrolled
Windows 10 Extended Security Updates for home users now last until 12 October 2027. But only enrolled PCs get them. Here's how to check, how to enroll...
Software
Laravel Queues and Cron on Shared Hosting: What Actually Works
Shared hosting can run Laravel queues and the scheduler reliably, but only if you design around its limits. Here's the setup that works, and the traps...
The stream
All storiesUpcoming Phones in India: December 2026 Launches to Wait For
Xiaomi 18 Pro, iQOO 16 and OnePlus 16R are the big flagships expected in India around December 2026, with Vivo X500 and Motorola Signature 27 already out. Here's what's confirmed so far.
Windows 10 ESU Now Runs to October 2027: How to Check Your PC Is Enrolled
Windows 10 Extended Security Updates for home users now last until 12 October 2027. But only enrolled PCs get them. Here's how to check, how to enroll for free, and when to plan your move.
GTA 6 PC Release Date: Everything Rockstar and Take-Two Have Actually Said
There is no official GTA 6 PC release date. Take-Two says any PC news will come from Rockstar. Based on GTA 5 and Red Dead Redemption 2, the realistic window is late 2027 to 2028.
ChatGPT Advanced Voice Is Being Retired on 11 December: What GPT-Live Changes
On 11 December 2026, ChatGPT retires Advanced and Standard voice and moves everyone to GPT-Live. Here's what GPT-Live does differently, what happens to custom GPTs and video, and your old chats.
ChatGPT Go Free Year Ending in India: Will You Be Charged ₹399, and How to Cancel
If you claimed free ChatGPT Go in India last year, your 12 months are ending. Here's when the ₹399 charge kicks in, how to cancel on web, Android and iPhone, and whether staying on Go is worth it.