Skip to content
Blog

8 min read

Test database changes in Lovable without production data

Lovable drafts can have a separate backend with sample data, but you still need to check the database structure, integrations and publishing process.

By Written with AI assistance from the source

Mist over a still, rocky coast in soft grey tones
Photo: Mark de Jong on Unsplash

What has changed in Lovable drafts

A draft in Lovable was previously mainly a separate version of the app's code and interface. The database was the sensitive part: if the draft used the same backend as the published app, a test could change real customer details, bookings or other production data.

In the update dated 16 November 2026, Lovable describes a separate backend for drafts. When a project uses Lovable's built-in backend, a new draft can now have its own database. It has the same structure as the active database, but is populated with sample data instead of real records.

This means you can build and test a change that saves new information without directly changing the production database. For example:

  • a new field in a booking form
  • a new table for comments or reviews
  • a new status for orders
  • changed rules for who can read or edit data
  • a backend function that processes information before it is saved

The distinction between structure and data is important. The structure describes which tables and columns exist, what type of information they store and which access rules apply. Data is the actual records in the tables – for example, a particular user, booking or order.

When you work in an isolated draft, you can change both the structure and the test data there. When you accept the draft, the structural changes are transferred to the active database. The test records, however, are not transferred. They are removed along with the draft's separate backend.

This makes drafts considerably more useful for features that require database changes. But it does not make them a complete test environment. Some parts are still connected to the active app, and accepting the draft can change production before you publish the interface.

Check which backend the draft uses

You should not assume that every draft is isolated. Lovable displays a banner above the preview when you are viewing sample data in a separate backend. If the banner is missing, the draft may share a database with the active app.

A draft normally shares the active database if the project uses its own Supabase project instead of Lovable's built-in backend. This can also happen if Lovable cannot copy the database structure, for example because of an unsupported database function or extension.

Always check the preview before creating, editing or deleting information:

  • Sample data banner: Changes to records remain in the draft.
  • No banner: Treat the database as production until you have confirmed otherwise.

This check is particularly important if the app is already in use. Deleting a draft does not undo changes made to a shared production database.

Even an isolated draft uses active values for secrets and connected services. A secret might be an API key that the app uses to contact Stripe, Resend or another service. If the draft calls the service, the call may be real even though the database is separate.

This means, among other things, that:

  • an email may be sent to a real address
  • an API call may create or change information in an external service
  • a payment through your own Stripe account may be real if the app uses an active key
  • a webhook may send its response to the active app rather than the draft
  • files in the project's shared file storage may be affected directly

A separate database therefore protects production records, but does not automatically isolate the entire system. Use test accounts, test modes and safe recipient addresses where the connected services support them.

How sample data works

Lovable populates the separate database with sample data so that the preview is not empty. You can therefore open lists, forms and detail pages without first creating all the test data manually.

The sample data still needs to be reviewed. Automatically created records may not represent the situations that are most difficult for your app. A booking system, for example, may work with a simple booking but fail when an optional field is missing, when a booking changes status or when users with different roles try to open the same view.

You can ask Lovable to create a reusable sample data file in db/seed.sql. This file describes which test records and test accounts should be created when a new draft database is built. It provides a more consistent test basis and makes it easier to repeat the same checks after later changes.

Good sample data should cover different states, not just the simplest route through the app. For a booking feature, this could mean records with and without optional information, different statuses and users with different permissions. For an administrative tool, you may need to check both what an ordinary user can see and what an administrator can change.

Avoid copying personal data unless you genuinely need it. Names, email addresses, payment details and free-text fields may contain information that does not belong in a test environment. If you need realistic relationships between records, you can copy the structure and replace the content with invented values.

Also remember that the draft's data may be reset when the draft is updated to match the project's current version. The code and chat may remain while test records disappear and the database is rebuilt from the sample data file. Put important test cases in db/seed.sql rather than relying on records you have entered manually.

A useful instruction for Lovable could be:

Create sample data for the main user roles and states. Do not use any real personal data. Put the data in db/seed.sql so that the tests can be repeated in new drafts.

What happens when you accept the draft

Accepting and publishing are separate steps. This is the most important detail to understand before using drafts for database work.

When you accept a draft, Lovable adds the code changes to the project's main version. Pages and interfaces do not become visible to visitors until you publish. However, the database structure, backend functions and some storage settings may change in the active environment as soon as the draft is accepted.

This can create a temporary intermediate state:

  • the published app still shows the old interface
  • the production database already has the new structure
  • changed backend functions may already be running
  • test data from the draft has been removed

A new optional column is often compatible with the old interface. A change that removes, renames or alters the meaning of something used by the published app is considerably more sensitive. The old version may then start producing errors between acceptance and publication.

Ask Lovable to describe the database change before accepting it. You need to know whether the change:

  • adds, removes or renames tables and columns
  • makes a previously optional field mandatory
  • changes a data type or default value
  • affects existing records that lack the new information
  • changes the rules governing who can read or write data
  • deploys new or changed backend functions

Lovable's version history is not the same as a database backup. Restoring code does not automatically restore the database structure or records. Export the database before accepting a change that is difficult to reverse or affects important information.

Plan acceptance and publication as one continuous piece of work. Test the draft, check the changes, take any necessary backup, then accept and publish without an unnecessarily long intermediate period.

Checklist before publishing

The separate draft database reduces the risk of test records ending up in production. Your review still needs to cover the entire flow from the interface to the database and external services.

  • Check that the sample data banner is displayed in the draft.
  • Confirm whether the project uses Lovable's built-in backend or its own Supabase project.
  • Ask Lovable to list which tables, columns and access rules will change.
  • Check that existing production records work even if they lack new fields.
  • Test forms with empty, invalid and unexpected values.
  • Check that information is both saved and displayed correctly after reloading.
  • Test relevant user roles and try to open data that the role should not be able to see.
  • Check whether secrets, emails, payments, webhooks or other integrations use active values.
  • Use invented personal data and test modes where possible.
  • Save recurring test cases in db/seed.sql.
  • Update the draft if the main project has changed while you have been working.
  • Export the database if the change affects important or difficult-to-replace information.
  • Decide who is allowed to accept drafts when several people are working on the project.
  • Prepare the publication before accepting a change that is not backwards-compatible.
  • Check the active app immediately after acceptance and after publication.

Drafts with a separate backend make it possible to test more than how a page looks. You can test how data is created, changed and protected without filling the production database with test records. However, safety still depends on checking which environment you are working in, understanding what acceptance changes and treating external integrations as active until confirmed otherwise.

When the data model, permissions and integrations start to become part of the core product, the route from prototype to product also needs to be planned as one coherent system.


Source: Lovable changelog

Want to know what your build would take?

Three questions, then you get a clickable sketch for free.

← All articles