Hey @redsuperbat 👋
You cannot directly create schema.prisma from a dump. You would need to connect to an existing database that has your data or import the dump that you have back in the DB.

Then, to add your tables to a schema.prisma file from your database is easy by using Introspection

As you're using MySQL, you would need to follow this tutorial to setup Prisma with an existing database.

Let me know if it works :)

🌐
Prisma
prisma.io › home › postgresql › postgresql › postgresql
How to add Prisma ORM to an existing project using PostgreSQL (15 min) | Prisma Documentation
Add Prisma ORM to an existing TypeScript project with MySQL and learn database introspection, baselining, and querying · Prerequisites1. Set up Prisma ORM2. Initialize Prisma ORM3. Connect your database4. Introspect your database5. Baseline your database6. Generate Prisma ORM types7. Instantiate Prisma Client8. Query your database9. Evolve your schema9.1.
Discussions

How to init migration with existing database
I already have a database and there is data in it. Now I want to use Prisma to connect with it .So I do following: 1. Create a schema.prisma file, config datasource and generator 2. Run `prisma db pull` to get latest schema 3. Run `prisma migrate dev` to init migration But step 3 got error, ... More on answeroverflow.com
🌐 answeroverflow.com
August 8, 2025
How do I use Prisma without having to wipe my database all the time?
Think of it like this: You have a table with some users, none of which have a last name. Now you update schema.prisma with a required column called lastName, without a default value. How should Prisma handle the migration for you? Since Prisma can't guess the last name of every user, the only reasonable thing it can do is to ask you to recreate the data—which means resetting that table. To work around that, you need two migrations. You first set the column's default value to a placeholder—ensuring every row has a value. You then make a second migration where you remove the default value. This is, of course, just one of many reasons for why Prisma would want to reset a table, or sometimes even the whole database (if the effect is large enough). Prisma migrations are great, and they make life so much easier! But you still need to consider how they are applied and design your database accordingly: Prisma won't be able to magically solve the logical impossibilities that may occur otherwise. So, just like with everything else in programming, you need to be careful and considerate, and the more you practice; the easier it gets. I think Prisma sometimes overpromises on "making database design easy". It sure makes it easier, but you still need to think about what's going on behind the scenes. The way it abstracts the database design behind a neat little schema—together with its automatic migrations—can sometimes make you miss the forest for all the trees. More on reddit.com
🌐 r/node
39
34
December 5, 2023
Problem with model and existing db
Hi, I have a postgresql db that already have tables populated with tons of data. I could not use the “prisma pull” cli as prisma does not handle cross schema references (yet, #1175), so I crated the model to one of the tables manually in the schema.prisma file: model Source { id Int @id ... More on community.redwoodjs.com
🌐 community.redwoodjs.com
0
0
May 3, 2021
Is it impossible to add new models to Prisma schema without dropping existing tables?
Are you using Prisma Migrate or just the client? If it's just the client, it doesn't matter, write your own migration script however you do that and add the model to your schema. If you are using Prisma Migrate, you can run prisma migrate dev --script and validate whether or not your schema is in sync with your database. If it's in sync with your database, it won't generate any output. If it does generate output or you're adopting Prisma Migrate on top of an existing database, you'll need to baseline your migrations before making changes to your schema that you want to apply. For what it's worth, it's extremely difficult to use Prisma Migrate unless you keep your schema in complete perfect lockstep with your database. There are a lot of teams that opt to using something like knex instead because of this restriction and there's no reason to force a square peg into a round hole just to adopt Prisma holistically. More on reddit.com
🌐 r/node
2
1
December 15, 2023
🌐
Medium
medium.com › dooboolab › start-using-prisma-in-your-existing-database-with-prisma-introspection-334a96701bab
Start using Prisma in your existing database with Prisma introspection | by Hyo | Hyo Dev | Medium
August 27, 2021 - If you are a javascript or typescript developer, I think you’ve already heard about Prisma, a next-generation ORM. ... I’ve recently found few developers who wants to start using Prisma but their product is sticked to other orm like Sequelize. I also know how frustrating it is to switch ORM but this can be achieved pretty easily by Prisma’s introspection and I will tell what this is in this article. Note that from Prisma 2.30.0, prisma instrospect command has changed to prisma db pull.
🌐
DEV Community
dev.to › prisma › friendly-data-modeling-auto-generated-editable-migrations-for-platformatic-with-prisma-dib
Friendly data modeling & auto-generated, editable migrations for Platformatic with Prisma - DEV Community
February 5, 2023 - With the schema defined, you will now auto-generate a database migration using prisma migrate diff. prisma migrate diff compares (or "diffs") two schemas, the current, and the anticipated version. The current version is the from state, and the anticipated version is the to state.
🌐
Prisma
prisma.io › home › pull › pull › pull
prisma db pull | Introspect Database to Prisma Schema | Prisma Documentation
Sync your Prisma schema from an existing database with prisma db pull. Introspect tables, relations, and generate Prisma models automatically.
Find elsewhere
🌐
Answer Overflow
answeroverflow.com › m › 1403243116718461010
How to init migration with existing database - Prisma
August 8, 2025 - I already have a database and there is data in it. Now I want to use Prisma to connect with it .So I do following: 1. Create a schema.prisma file, config datasource and generator 2. Run `prisma db pull` to get latest schema 3. Run `prisma migrate dev` to init migration But step 3 got error, Prisma tells me that my schema is not sync and prompts me to reset database.
🌐
Prisma
prisma.io › home › overview of prisma migrate › overview of prisma migrate
Prisma Migrate: Database, Schema, SQL Migration Tool | Prisma Documentation
Prisma Migrate can be considered a hybrid database schema migration tool, meaning it has both of declarative and imperative elements: Declarative: The data model is described in a declarative way in the Prisma schema.
🌐
Prisma
prisma.io › home › introduction to prisma client › introduction to prisma client › introduction to prisma client › introduction to prisma client
Introduction to Prisma Client | Prisma Documentation
ReferencePrisma CLI referencePrisma Client APISchema APIConfig APIConnection URLsEnvironment VariablesDatabase FeaturesSupported databasesSystem requirementsError ReferencePrisma Error ReferencePrisma Client & Prisma schemaPrisma CLI Preview features · MoreBest practicesORM releases and maturity levels ... Prisma Client is an auto-generated and type-safe query builder that's tailored to your data. The easiest way to get started with Prisma Client is by following the Quickstart. ... import 'dotenv/config'; import { defineConfig, env } from 'prisma/config'; export default defineConfig({ schema: './prisma/schema.prisma', datasource: { url: env('DATABASE_URL'), }, });
🌐
Amplication
docs.amplication.com › day-one › upload-schema
Upload Schema - Amplication
When you upload a Prisma schema, Amplication inspects your existing database structure and generates corresponding entities, fields, and relationships. By standardizing and automating the process, Amplication helps you maintain consistency and best practices across your organization, saving significant time and reducing technical debt. To generate a Prisma schema from your existing database, you’ll use Prisma’s introspection feature.
🌐
Reddit
reddit.com › r/node › how do i use prisma without having to wipe my database all the time?
r/node on Reddit: How do I use Prisma without having to wipe my database all the time?
December 5, 2023 -

I'm using Prisma for a large project I've been working on for the past few months, and I still don't understand the flow of it. At first I was migrating every time I made a change to my schema, and constantly getting the "All data will be lost" prompt. Since then I've learned to use `db push` while developing and then migrate when a feature is finished, but it's still constantly making me reset my database.

Right now I'm using the same db for dev and staging (because I don't want to pay for 2 different ones) but I'd imagine this would still be an issue if I had separate databases. What do I need to do to stop being forced to reset my db? Or, at least, how would I migrate my development db to mirror my production db without it being wiped?

As you can probably tell, this is my first time working with Prisma (or any ORM, in depth) so this might be a stupid question, but I can't find much online besides general tutorials. Any help would be greatly appreciated!

Top answer
1 of 5
23
Think of it like this: You have a table with some users, none of which have a last name. Now you update schema.prisma with a required column called lastName, without a default value. How should Prisma handle the migration for you? Since Prisma can't guess the last name of every user, the only reasonable thing it can do is to ask you to recreate the data—which means resetting that table. To work around that, you need two migrations. You first set the column's default value to a placeholder—ensuring every row has a value. You then make a second migration where you remove the default value. This is, of course, just one of many reasons for why Prisma would want to reset a table, or sometimes even the whole database (if the effect is large enough). Prisma migrations are great, and they make life so much easier! But you still need to consider how they are applied and design your database accordingly: Prisma won't be able to magically solve the logical impossibilities that may occur otherwise. So, just like with everything else in programming, you need to be careful and considerate, and the more you practice; the easier it gets. I think Prisma sometimes overpromises on "making database design easy". It sure makes it easier, but you still need to think about what's going on behind the scenes. The way it abstracts the database design behind a neat little schema—together with its automatic migrations—can sometimes make you miss the forest for all the trees.
2 of 5
19
bruh
🌐
GitHub
github.com › prisma › prisma › discussions › 25179
How to Automatically Update Schema When Database Has No Relations but Schema Has Manual Relations · prisma/prisma · Discussion #25179
However, our Prisma schema has defined these relationships, so we cannot synchronize the database and generate the new schema through migrations, we would have to handle this manually. I'm concern about potential errors with manual handling and we preference for automation (e.g., through migrations).
Author   prisma
🌐
Prisma
prisma.io › home › import from postgresql › import from postgresql
Import from existing Postgres database into Prisma Postgres | Prisma Documentation
If you are not yet using Prisma ... Postgres from your application: Install the Prisma CLI and other required dependencies in your project · Introspect the database to generate a Prisma schema ... You can find the detailed step-by-step instructions for this process in this guide: Add Prisma ORM to an existing ...
🌐
Prisma
prisma.io › home › what is introspection? › what is introspection? › what is introspection?
What is introspection? (Reference) | Prisma Documentation
Read the connection URL from the datasource configuration in the Prisma config ... Introspect database schema (i.e. read tables, columns and other structures ...) Transform database schema into Prisma schema data model · Write data model into ...
🌐
Prisma
prisma.io › blog › advanced-database-schema-management-with-atlas-and-prisma-orm
Advanced Database Schema Management with Atlas ...
December 12, 2024 - Define an external_schema called prisma via the data block: Atlas integrates database schema definitions from various sources. In this case, the source is the SQL that's generated by the prisma migrate diff command, specified via the program field.
🌐
RedwoodJS Community
community.redwoodjs.com › get help and help others
Problem with model and existing db - Get Help and Help Others - RedwoodJS Community
May 3, 2021 - Hi, I have a postgresql db that already have tables populated with tons of data. I could not use the “prisma pull” cli as prisma does not handle cross schema references (yet, #1175), so I crated the model to one of the tables manually in the schema.prisma file: model Source { id Int @id @default(autoincrement()) name String? name_acronym String? description String? url String? contract String?
🌐
Kysely
kysely.dev › generating types
Generating types | Kysely
prisma-kysely - This library generates Kysely database schema type definitions from your existing Prisma schemas.