A quick recap if you are joining here. Lovable gives me one managed database, and I wanted a dev side and a prod side. In the first post, I got one database to act like two, using separate schemas picked by the web address.
The test worked. I want to say that first, because the interesting part is what I did next.
Two databases inside one, picked by the web address, with a wall that held in both directions. I had a working answer to a problem I cared about. And I decided not to use it in the build I start on October 15.
What it would cost
The test gave me a precise bill:
Every change to a table has to be made twice, once per schema.
The generated types only know about
public, so my queries need a workaround that turns off some of the checking.The Cloud tab cannot show me the tables, so I would read my own data through queries.
Users are shared across both worlds, so a dev sign-in is also a prod sign-in.
The hostname rule is a convenience, not a lock. Row level security is the real protection.
None of that is a dealbreaker. All of it takes hours.
The number that decided it
The build I start on October 15 is a Lovable event. It is called 72 hours, but the clock from kickoff to deadline is 60, and some of those hours are sleep. After all that setup, the “prod” side would hold almost nothing except demo data. I would be paying doubled migrations to protect a database with nothing precious in it.
Feasible and worth it are two different questions. The test answered the first one. It could not answer the second, and I almost let it.
There is another way out, and I should say so. What I want may be possible on a Lovable Business account. I have not made that leap, yet. If it is possible, that trades hours for money, which is a different question, and one I will ask once the build is over.
Where it goes instead
This is now a pattern I have tested and written down, parked for after October 17. When I come back to it, I will add two things the test showed I need:
One wrapper that owns the schema choice, so the workaround lives in a single place.
A check that fails any query that does not name its schema, so nobody has to remember.
I wrote the decision down with the full test results, so future me does not have to rerun the experiment. If you are building on Lovable and have wished for a dev database, the prompts in the first post will get you started.
Curiosity is allowed to run ahead of the build. It just does not get to pick what goes in it.
Alison + Lovelace


