Demo, all content is generated
Question

I connected the wrong Supabase project to Lovable, how do I switch?

Solved · 291 views · asked by renata_builds · edited

I have two Supabase projects (one test one from a tutorial). Lovable connected to the tutorial one and built all my tables there. I want everything in the other project. Can I just switch?

What I’ve tried

Looked in the Lovable settings, I see the Supabase connection but no obvious 'change project'.

Comment
Is there any real data in the tutorial project? mira_dev · edited
no, only my tables and some test rows renata_builds · edited

2 answers

Marked as helpful by the asker
mira_dev · edited

Switching the connection is the easy part (disconnect, reconnect, pick the other project). The tables won't move with it though, they live in the tutorial project.

So:

  1. In the tutorial project, SQL editor: copy the schema. Easiest is to check if Lovable put migration files in supabase/migrations/ in your code, those can just be run in the new project in order.
  2. Run them in the new project's SQL editor.
  3. Data: if it's test data, skip it. Otherwise export per table as CSV and import.
  4. Then switch the connection in Lovable, and check the app's env vars point to the new project.
  5. Auth settings (Site URL, providers) are per project, redo them.

Or the honest shortcut: if the tutorial project is otherwise empty, just rename it in Supabase and keep using it. Nothing forces you to move.

Comment
Oh I didn't realize I can just rename it. Did that. Easy renata_builds · edited
Best kind of migration is the one you don't do. mira_dev · edited
hannah_reyes · edited

If you ever do want to move: supabase db dump from the CLI gives you the whole schema as SQL in one file.

Comment