Just because model code is unavailable does not mean the DB table is not there

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the dumb-mistakes-and-gotchas category.

Last Updated: 2024-11-21

I inherited a Laravel (MVC/ORM web app framework) project and it had no User.php model so I assumed there must be no users table.

I ended up writing a migration for this users table but then it failed: In fact, the table was already present!

I should have inspected the database (or the migrations) when initially inheriting the code. What threw me off was that I did not see a user model anywhere.

Lesson

When starting a project, inspect the actual DB structure as well as the codebase.

The ORM models are not a full picture of the DB structure.