Robbin Schuchmann
Robbin Schuchmann
June 4, 2025

Fixing database issues with room types (Day 30)

So here's the thing about building a travel directory in public - sometimes you spend an entire day fighting with database connections that should work but don't. And honestly? That's exactly what happened to me yesterday.

Quick summary

I was trying to add room types to the Bali Handbook (my travel directory project), but the database kept eating my data. Images wouldn't save, form fields disappeared, and adding a second room type broke everything. After hours of debugging with Cursor AI, I finally figured out the real problem: my form wasn't actually sending all the data to the database. Classic.

Why I'm sharing this debugging nightmare

Living here in Bali and building this travel directory, I've realized that the messy, frustrating parts of development are actually the most valuable to share. Everyone shows you the polished final product, but nobody talks about spending three hours wondering why your perfectly logical code refuses to work.

Plus, I got some great questions about Supabase recently, so maybe walking through this debugging process will help someone else avoid the same headache.

The challenge I was facing

Okay, so context: I'm building the Bali Handbook with my partner (she's the influencer, I handle the tech side). We've got this database structure where listings connect to stays, and stays connect to room types. Pretty standard stuff.

But when I tried to add room types to our properties, everything went sideways:

  • Images uploaded but didn't display on the frontend

  • The "suitable for" and "included/not included" fields vanished

  • Adding a second room type crashed the whole form

  • Data kept disappearing after I saved it

I'm not gonna lie, this was way more frustrating than it should have been.

What I tried first (spoiler: it didn't work)

My first instinct was to blame Supabase. The data was there one minute, gone the next. I checked the storage bucket, verified the database structure, even redrew the whole relationship diagram to make sure I understood how everything connected.

The database structure looked solid:

  • Listings table: Generic info for all properties

  • Stays table: Specific hotel/accommodation details

  • Room types table: Individual room information

Everything was properly connected with foreign keys. So why wasn't it working?

The breakthrough moment (thanks, Cursor AI)

Here's where it gets interesting. I've been using Cursor as my AI code editor, and normally I love it. But sometimes it goes into what I call "YOLO mode" - just starts making changes without asking.

This time I was smarter. I told Cursor: "First give me recommendations before you implement anything." Because honestly, I've had AI editors break my entire codebase by being too eager to help.

The analysis came back pretty quickly: the room type form wasn't properly connected to the main form submission. All my data was getting lost because the form wasn't actually sending the complete information to the database.

Here's how I actually debugged it

Step 1: Understanding the data flow

First, I had to map out exactly what was happening when someone submitted the form. Turns out, I had two different save functions:

  • One for the individual room type (which worked)

  • One for the complete stay form (which was overriding everything)

Step 2: Adding console logs everywhere

You know what's funny? I used to think console.log was just for beginners. But when you're debugging complex form submissions, those logs become your best friend.

I added logs to track:

  • What data was being collected

  • When each save function triggered

  • Which fields were actually making it to the database

Step 3: Following the data trail

The console logs revealed the real problem. When I pressed the main "Save Changes" button, it was pulling some room type data but completely ignoring the images, "suitable for" field, and other specific room details.

The individual room save button worked perfectly. The main form save button was the culprit.

The stuff that went wrong

Plot twist: it wasn't just one problem. I discovered a whole chain of issues:

Database field mismatch: Some form fields weren't mapped to the correct database columns

Image upload timing: Images were uploading to Supabase storage but the reference wasn't being saved with the room data

Form state management: The main form wasn't tracking changes to the nested room type components

Numeric field overflow: At one point, price fields were causing database errors because of formatting issues

Honestly, each fix revealed another problem. It was like debugging Russian nesting dolls.

How I fixed the problems

The solution ended up being simpler than I expected (isn't it always?). I had to:

  1. Fix the form data collection: Make sure the main form was actually gathering all the room type information before submitting

  2. Sync the save functions: Ensure both the individual and bulk save operations used the same data structure

  3. Handle image uploads properly: Store the image references correctly in the database

  4. Add proper error handling: So I'd know immediately when something broke instead of wondering why data disappeared

The breakthrough came when Cursor finally identified that the main form wasn't including all the room type fields in its database insert. Once we fixed that connection, everything started working.

What it looks like now

Now I can add multiple room types to each property, complete with:

  • Images that actually display

  • Proper pricing in USD (still need to decide between USD and EUR)

  • "Suitable for" descriptions

  • Included and not-included amenities

  • Everything saves properly, both individually and in bulk

The frontend displays all room types correctly, and I can finally start adding real data to the platform.

Lessons I'm taking from this

AI code editors are powerful but need guidance: Cursor is amazing, but I learned to ask for analysis first instead of letting it make changes immediately. The MCP (Model Context Protocol) feature is particularly helpful for database debugging.

Console logs are underrated: I used to think they were messy, but they're incredibly valuable for tracking data flow in complex forms.

Database relationships matter: Even when your structure looks correct, the actual data flow between forms and database can break in unexpected ways.

Sometimes the obvious solution is wrong: I spent hours thinking it was a Supabase issue when it was actually a form submission problem.

What I'm working on next

Now that room types are working, I need to:

  • Add all our actual stays to the platform (my partner is collecting the data)

  • Create content for location pages with proper internal linking for SEO

  • Set up video embedding for TikTok, Instagram Reels, and YouTube content

  • Fix some navigation issues where restaurant pages show up in the wrong categories

The goal is to get the website live soon and start driving traffic through social content. We're planning to create video content for every property we feature, then route that traffic to our affiliate links.

Final thoughts

You know what's wild about this whole experience? I probably learned more from this debugging session than from building features that worked perfectly the first time.

There's something valuable about wrestling with a problem for hours, getting frustrated, and then having that "aha!" moment when everything clicks. Plus, now I understand my database structure way better than before.

If you're building something similar and running into weird form submission issues, check your data flow first. Nine times out of ten, it's not the database - it's how you're sending data to the database.


Following along with my 60-day challenge to build the Bali Handbook? I'm documenting everything - the wins, the failures, and the debugging nightmares. Subscribe if you want to see how this travel directory turns out (and maybe learn from my mistakes along the way).

Robbin Schuchmann

Robbin Schuchmann

Entrepreneur and founder of multiple companies in the global employment space. Passionate about simplifying global hiring and connecting talent across borders.