Why "npx prisma db pull" is blocked on Introspecting?

31 views Asked by At

hello I want to add a table in my database (supabase). So I add this in supabase. And when I try to pull my table (from database supabase) with npx prisma db pull for uptdate prisma schema the command is blocked.

I try also this and I have the same result : npx prisma migrate dev

It’s been a while since I had assigned a command with prisma on this project but otherwise everything works because I can use the database in my project

I don’t know much prisma so I may have forgotten something Thank you for your help

prisma stuck

1

There are 1 answers

1
Derek Williams On

I just fired up a new project to verify that this works:

npm init
npm install prisma --save-dev

Add .env file with database information, e.g.

DATABASE_URL="postgresql://postgres.xxxxyyyyzzzz:[email protected]:5432/postgres?schema=public"

where postgres.xxxxyyyyzzzz is they user name, and passpasspass is the password

Then run

npx prisma init --datasource-provider postgresql

And finally:

npx prisma db pull

Which produces the prisma/schema.prisma file, first few lines:

/// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
model locations {
  location_name    String             @db.VarChar(255)
  street_address   String             @db.VarChar(255)
  city             String             @db.VarChar(100)
  state_province   String             @db.VarChar(100)
  postal_code      String             @db.VarChar(20)
  unit_number      String?            @db.VarChar(20)
  notes            String?
  id               String             @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
  service_requests service_requests[]
}

Edit: Then I added a new table Foo, and ran npx prisma db pull again, adds the table to the schema

/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
/// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
model foo {
  id         BigInt   @id @default(autoincrement())
  created_at DateTime @default(now()) @db.Timestamptz(6)
}