7 months ago
4e6cbd4f-4d07-491a-9c53-1301d52e4923
Hi everyone,
If anyone here use the combination of: Railway, NestJs & Supabase
I have a hard time configuring the Supabase,
The Supabase is connected successfully to NestJs in Railway using ENV var of DATABASE_URL.
➡️ But I don't know how to migrate prisma,
I did run npx prisma migrate deploy locally but it didn't work
I checked the Supabase and I found that it did create a table that reflecting the initial migration, but there was two migrations missing, at the end I have deleted the table (I don't know actually how I did end creating that table, because I was fighting with that all the day, searching on my own and using AI, but no result)
19 Replies
7 months ago
Have you tried using the Railway CLI's SSH capabilities to run the command?
7 months ago
Or alternatively, a Supabase Template
No I don't, since I have no idea about any of the deployment, this is my first deployed project ever
I'll look for those, thanks Adam a lot
7 months ago
Is the install guide at the top of the page not enough?
7 months ago
There are step by step instructions for both installation and using the SSH capabilities in the docs
I did the following:
installed the Railway CLI
Connected the shell to my Railway account
and then I did runnpx prisma migrate deploy,
It did show:
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "postgres", schema "public" at "aws-0-ap-south-1.pooler.supabase.com:6543"The shell like freezed, it didn't terminate, it just stayed there
I got a command from ChatGpt to check my DB connection is working: npx prisma db pull:
And also it did freeze on:
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "postgres", schema "public" at "aws-0-ap-south-1.pooler.supabase.com:6543"
- Introspecting based on datasource defined in prisma/schema.prismaThey took too long so that I terminate them manually
7 months ago
Sounds like your command went through, why did you terminate it?
I will try a solution provided by Gemini, it suggest to usenpx prisma migrate deploy && npm start:prod
at Custom Start Command,
I did use that before, but it didn't work,
What Gemini, suggest is that
the Supabase connection pooler URL (the one that uses port 6543) is optimized for running queries from your application but is not compatible with running migrations. Migrations require a direct, non-pooled connection to the database to alter the schema.
I'll try to apply that and see if it gonna workout
I didn't read carefully:
Look what already Supabase is saying:
# Direct connection to the database. Used for migrations
DIRECT_URL="postgresql://postgres.arphbeijateuxclzjosv:[YOUR-PASSWORD]@aws-0-ap-south-1.pooler.supabase.com:5432/postgres"It is clear that the DIRECT_URL is used for MIGRATIONS
I'll test it, and I hope that it will work
Thanks Adam
I did fix finally, I was frustrated all the day,
The problem is that I only added Transaction pooler,
When I got faced with the two existed links, I thoughts I had to choose between them, so that I did choose Transaction pooler, but the other one is the one used for migrations,
I got other Errors, but what matter now is that the DB Table did created successfully
7 months ago
great! glad to hear it. Am I good to mark this thread as solved?
7 months ago
!s
Status changed to Solved adam • 7 months ago