Base44 database

Database Relationship and Foreign Key Errors in Base44

Your Base44 app uses related database tables (for example, a Users table linked to an Orders table), but the relationships are not working correctly. Related records don't appear in linked views, creating a record in one table doesn't properly reference the related record in another, or deleting a record causes unexpected cascade effects.

This issue often manifests as dropdown selectors for related records showing empty lists, detail pages failing to display linked data, or errors when trying to create records that reference other tables.

Relationship issues can be subtle and may only appear with certain data combinations or when the related tables grow beyond a small number of records.

Error Messages You Might See

Referenced record not found Foreign key constraint violation Cannot delete record: referenced by other records
Referenced record not foundForeign key constraint violationCannot delete record: referenced by other records

Common Causes

  1. The relationship field type is incorrectly configured (e.g., using a text field instead of a proper reference/relation field)
  2. The referenced record was deleted but the foreign key reference still exists, creating orphaned records
  3. The relationship direction is inverted: the link field is on the wrong table
  4. The relation field references the wrong column (e.g., referencing a name field instead of the unique ID)

How to Fix It

Review your table schemas and ensure that relationship fields use Base44's proper relation/reference field type, not a plain text or number field storing IDs manually. The built-in relation type handles the linking automatically.

Check the direction of the relationship: a one-to-many relationship (e.g., one User has many Orders) requires the link field on the "many" side (Orders), not on the "one" side (Users).

For existing apps with broken relationships and orphaned records, a developer can help clean up the data and reconfigure the schema correctly without losing existing records.

Real developers can help you.

Matthew Jordan Matthew Jordan I've been working at a large software company named Kainos for 2 years, and mainly specialise in Platform Engineering. I regularly enjoy working on software products outside of work, and I'm a huge fan of game development using Unity. I personally enjoy Python & C# in my spare time, but I also specialise in multiple different platform-related technologies from my day job. Daniel Vázquez Daniel Vázquez Software Engineer with over 10 years of experience on Startups, Government, big tech industry & consulting. MFox MFox Full-stack professional senior engineer (15+years). Extensive experience in software development, qa, and IP networking. Milan Surelia Milan Surelia Milan Surelia is a Mobile App Developer with 5+ years of experience crafting scalable, cross-platform apps at 7Span and Meticha. At 7Span, he engineers feature-rich Flutter apps with smooth performance and modern UI. As the Co-Founder of Meticha, he builds open-source tools and developer-focused products that solve real-world problems. Expertise: 💡 Developing cross-platform apps using Flutter, Dart, and Jetpack Compose for Android, iOS, and Web. 🖋️ Sharing insights through technical writing, blogging, and open-source contributions. 🤝 Collaborating closely with designers, PMs, and developers to build seamless mobile experiences. Notable Achievements: 🎯 Revamped the Vepaar app into Vepaar Store & CRM with a 2x performance boost and smoother UX. 🚀 Launched Compose101 — a Jetpack Compose starter kit to speed up Android development. 🌟 Open source contributions on Github & StackOverflow for Flutter & Dart 🎖️ Worked on improving app performance and user experience with smart solutions. Milan is always happy to connect, work on new ideas, and explore the latest in technology. hanson1014 hanson1014 Full-stack developer experienced in fixing and deploying AI-generated apps from Lovable, Bolt.new, Cursor, and Replit. I specialize in debugging Supabase integration issues (auth flows, RLS policies, database connections), fixing broken deployments, resolving routing/blank screen problems, and cleaning up messy React/Vite codebases. I also build production apps with the Claude API and have shipped a Mac desktop dev tool (Nexterm from scratch. Based in Hong Kong, fast turnaround. Matthew Butler Matthew Butler Systems Development Engineer @ Amazon Web Services Kingsley Omage Kingsley Omage Fullstack software engineer passionate about AI Agents, blockchain, LLMs. legrab legrab I'll fill this later Taufan Taufan I’m a product-focused engineer and tech leader who builds scalable systems and turns ideas into production-ready platforms. Over the past years, I’ve worked across startups and fast-moving teams, leading backend architecture, improving system reliability, and shipping products used by thousands of users. My strength is not just writing code — but connecting product vision, technical execution, and business impact. Yovel Cohen Yovel Cohen I got a lot of experience in building Long-horizon AI Agents in production, Backend apps that scale to millions of users and frontend knowledge as well.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently Asked Questions

Why don't my linked records show up in Base44?

Make sure you're using Base44's relation field type, not a plain text field. The relation field type automatically handles the linking and display of related records.

How do I fix orphaned records in Base44?

Orphaned records occur when a referenced record is deleted. You may need to clean up the orphaned references manually or set up cascade rules to handle deletions automatically.

Related Base44 Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help