Hey there, Nikolas from Prisma here! If I continue to build my DB architecture directly in the db, is the Prisma db pull a reliable method to keep my Prisma schema up to date and accurate so I can get the typing's? This is definitely a valid approach! I think a lot of people prefer writing their own migrations (using whatever tool they prefer for that) and then use Prisma's introspection to update their Prisma schema — the main thing to be aware of with that workflow is that you need to run npx prisma generate after each introspection run to make sure the generated Prisma Client types and API get updated. This is also covered in the docs as a typical Prisma workflow: SQL migrations and introspection Answer from nikolasburk on reddit.com
🌐
Prisma
prisma.io › home › pull › pull › pull
prisma db pull | Introspect Database to Prisma Schema | Prisma Documentation
generator client { provider = "prisma-client" output = "../generated/prisma" } datasource db { provider = "sqlite" } import { defineConfig, env } from "prisma/config"; export default defineConfig({ schema: "prisma/schema.prisma", migrations: ...
🌐
Prisma
prisma.io › home › prisma cli reference › prisma cli reference › prisma cli reference
Prisma CLI reference | Prisma Documentation
<glob> is a placeholder for a glob pattern to specify which local Prisma Postgres instances should be removed, for example: ... To remove all databases that begin with mydb (e.g. mydb-dev and mydb-prod), you can use a glob: ... The rm command is interactive and includes safety prompts to prevent accidental data loss. The db pull command connects to your database and adds Prisma models to your Prisma schema that reflect the current database schema.
Discussions

Is Prisma DB Pull reliable?
Hey there, Nikolas from Prisma here! If I continue to build my DB architecture directly in the db, is the Prisma db pull a reliable method to keep my Prisma schema up to date and accurate so I can get the typing's? This is definitely a valid approach! I think a lot of people prefer writing their own migrations (using whatever tool they prefer for that) and then use Prisma's introspection to update their Prisma schema — the main thing to be aware of with that workflow is that you need to run npx prisma generate after each introspection run to make sure the generated Prisma Client types and API get updated. This is also covered in the docs as a typical Prisma workflow: SQL migrations and introspection More on reddit.com
🌐 r/node
3
4
August 14, 2023
Ecto equivalent for "prisma db pull"?
Once nice thing about Prisma is you can connect to an existing database, and use the CLI to run “prisma db pull” - and then it uses introspection on the database to build a nice model file. The thing that is not as nice, is then the models are prisma models, not Ecto schemas 🙂 Is there ... More on elixirforum.com
🌐 elixirforum.com
7
0
September 23, 2024
prisma db pull doesn't see a new table - Stack Overflow
I have existing schema for prisma. I copied the table from another schema to be included in the Prisma schema. But when I run prisma db pull new table doesn't appear in Prisma schema. Why? More on stackoverflow.com
🌐 stackoverflow.com
stuck while running prisma db push or pull
I also tried going in to supabase, ... prisma db pull and have a similar result, no error just a running Introspecting based on datasource defined in prisma\schema.prisma ... Beta Was this translation helpful? Give feedback. ... Thank you for raising this question. Can you try to use the direct connection string rather than the pooled one. Here is an example of a direct ... More on github.com
🌐 github.com
7
3
June 5, 2024
🌐
Prisma
prisma.io › home › what is introspection? › what is introspection? › what is introspection?
What is introspection? (Reference) | Prisma Documentation
Running prisma db pull for relational databases with an existing Prisma Schema merges manual changes made to the schema, with changes made in the database. For MongoDB, Introspection for now is meant to be done only once for the initial data model.
🌐
Fig
fig.io › manual › prisma › db › pull
prisma db pull | Fig
prisma db pull · prisma db push · prisma db seed · prisma db execute · prisma version · prisma version · prisma version --json · No description · On this page ·
🌐
Prisma
prisma.io › home › db › db
prisma db | Database Schema & Lifecycle Commands | Prisma Documentation
The prisma db command group provides tools to manage your database schema and lifecycle during development. ... # Pull schema from database prisma db pull # Push schema to database prisma db push # Seed the database prisma db seed # Execute a SQL script prisma db execute --file ./script.sql
🌐
Reddit
reddit.com › r/node › is prisma db pull reliable?
r/node on Reddit: Is Prisma DB Pull reliable?
August 14, 2023 -

My backend is a fastify/Prisma to a PostgreSQL DB, I am much more comfortable with building my DB tables and constraints (PK, FK, etc) via SQL rather than Prisma's relationships schema.

My question is: If I continue to build my DB architecture directly in the db, is the Prisma db pull a reliable method to keep my Prisma schema up to date and accurate so I can get the typing's?

I just am able to comprehend and explain the relationship much better via SQL rather than via the model references.

🌐
Prisma
prisma.io › home › views › views › views › views
How to include views in your Prisma schema | Prisma Documentation
Support for views is currently a Preview feature. You can add a view to your Prisma schema with the view keyword or introspect the views in your database schema with db pull. You cannot yet apply views in your schema to your database with Prisma Migrate and db push unless the changes are added manually to your migration file using the --create-only flag.
Find elsewhere
🌐
MCP Servers
mcpservers.org › home › agent skills library › prisma-cli-db-pull
prisma-cli-db-pull | Agent Skills Library
For MongoDB, db pull samples documents to infer schema: ... May require manual refinement since MongoDB is schemaless. ... Upgrade Prisma Next in your extension.
🌐
Codú
codu.co › home › niall maher › pull schema from database in prisma
Pull Schema From Database in Prisma | by Niall Maher | Codú
February 21, 2024 - With Prisma you can pull the schema from your connected database by running: npx prisma db pull · This overwrites your current schema.prisma with the one it infers from your database.
🌐
Prisma
prisma.io › home › multi-schema › multi-schema › multi-schema › multi-schema
How to use Prisma ORM with multiple database schemas | Prisma Documentation
The following example adds a "base" and a "shop" schema: ... generator client { provider = "prisma-client" output = "./generated" } datasource db { provider = "postgresql" schemas = ["base", "shop"] }
🌐
Nile
thenile.dev › get started › schema migrations › prisma
Prisma - Nile Documentation
December 8, 2025 - 2 · Generate Prisma client · ... own models. For example: model posts { id String @default(dbgenerated("public.uuid_generate_v7()")) @db.Uuid tenant_id String @db.Uuid title String content String?...
🌐
Prisma
prisma.io › home › schema api › schema api › schema api
Prisma Schema API | Prisma Documentation
You can use prisma db pull to infer the correct value to resolve the discrepancy. (Related issue) circle Unsupported("circle")? @default(dbgenerated("'<(10,4),11>'::circle")) You can also use dbgenerated(...) to set the default value for supported types. For example, in PostgreSQL you can generate UUIDs at the database level rather than rely on Prisma ORM's uuid():
🌐
Elixir Forum
elixirforum.com › questions & help › questions
Ecto equivalent for "prisma db pull"? - Questions - Elixir Programming Language Forum
September 23, 2024 - Once nice thing about Prisma is you can connect to an existing database, and use the CLI to run “prisma db pull” - and then it uses introspection on the database to build a nice model file. The thing that is not as nice, is then the models are prisma models, not Ecto schemas 🙂 Is there ...
Top answer
1 of 3
2

I had a similar issue once and a quick check confirmed for me that it was the lack of security permissions granted for prisma on new table in the database itself.

Try this:

  • Note the name of the database user that Prisma connects to the database with. You'll likely find this via your schema.prisma file, or perhaps via a DATABASE_URL config setting in the related .env file if you're using that with prisma.
  • Go into the database itself and ensure that database user which Prisma connects with has been granted sufficient security privileges to that new table. (note: what 'sufficient' is I cannot say since it depends on your own needs. At a guess, I'd say at least 'select' permission would be needed.)
  • Once you've ensure that user has sufficient privileges, try running a prisma db pull command once again.

For reference, another thing you could do is:

  • cross-check against one of the other tables that is already in your database that works correctly with prisma.
  • compare the security privileges of that old table with the security privileges of the new table and see if there are any differences.
2 of 3
1

If you use supabase and running this command and it returns something like this 'The following models were commented out because we couldn't retrieve columns for them. Please check your privileges.' or something similar regarding privileges, the solution is to go to your SQL editor from supabase and put this command and execute it

GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO postgres;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO postgres;
🌐
GitHub
github.com › prisma › prisma › discussions › 15775
How can i pull or introspect a defined list tables · prisma/prisma · Discussion #15775
Hi @kaykhan 👋 It's not possible at the moment, npx prisma db pull will introspect all the database tables.
Author   prisma
🌐
Xata
xata.io › blog › prisma-postgres-xata-integration
Using Prisma with Xata's Postgres service by Emily Morgan
May 6, 2025 - Here is an example of how you could add a new field to your existing database schema via the Prisma Schema file and have those changes applied to your remote database. ... After saving this file, run prisma db push.
Top answer
1 of 3
4

Some prisma CLI commands(ex: npx prisma db pull) require DIRECT_URL to be passed as part of datasource object like below.

datasource db {
  provider  = "postgresql"
  url       = env("DATABASE_URL")
  directUrl = env("DIRECT_URL")
}

You can read about it more here: Prisma Datasource fields

The Direct Url uses Session Mode URL and connects via port:5432. Whereas Database URL uses Transaction Mode URL and connect via port:6543

Note: I'm using Supabase, which is a PostgreSQL database.

2 of 3
0

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:passpasspass@aws-0-us-west-1.pooler.supabase.com: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)
}