<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Satyamupadhyay on Medium]]></title>
        <description><![CDATA[Stories by Satyamupadhyay on Medium]]></description>
        <link>https://medium.com/@satyamupadhyay00915?source=rss-5662c8d0e9d3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*0LCXJkCJHFMv1ib0</url>
            <title>Stories by Satyamupadhyay on Medium</title>
            <link>https://medium.com/@satyamupadhyay00915?source=rss-5662c8d0e9d3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 20:15:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@satyamupadhyay00915/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Prisma version 8 setup with Next JS using PostgreSQL]]></title>
            <link>https://medium.com/@satyamupadhyay00915/prisma-version-8-setup-with-next-js-using-postgresql-18d0b18ea4c4?source=rss-5662c8d0e9d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/18d0b18ea4c4</guid>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[setup]]></category>
            <category><![CDATA[prisma]]></category>
            <category><![CDATA[postgresql]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[Satyamupadhyay]]></dc:creator>
            <pubDate>Mon, 23 Nov 2026 14:44:35 GMT</pubDate>
            <atom:updated>2026-11-23T15:46:23.192Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8OkhVe0fDoHy7VvmkL0iYQ.png" /></figure><p>So If you are reading this you already have a Nextjs Project Setup. Eventhough Prisma docs are straight forward still if someone is facing any diffuculty this documentation is for them.</p><p>The first command to run to install prisma in your project is to go to the root directory of your nextjs project.<br>Run this command.</p><pre>npx prisma@latest orm init --target postgres --authoring psl --write-env</pre><p>So after you run this command one question will be prompted on the terminal about the location of the contract.prisma.<br>You can keep that as ./prisma/contract.prisma which means to have the prisma folder in the root dir itself.</p><p>Once this runs you will see inside the prisma folder a db.ts file which has postgres initialized and some files such as contract.d.js and contract.json which arent created yet. These will be created in the further steps to come.</p><p>Now go to your .env file and get a postgresql db url and paste it there.</p><p>Either you can use docker or get a free instance from neondb.</p><p>Now go to prisma/contract.prisma and create a new model as per your requirements or you can use the one below.</p><pre>// use prisma-8<br><br>model User {<br>  id    Int     @id @default(autoincrement())<br>  email String  @unique<br>  name  String?<br>}</pre><p>Keep the Top comment use prisma-8 as that is essential for the further commands to identify.</p><p>Now run this command</p><pre>npx prisma contract emit</pre><p>Whenever you change anything inside contract.prisma the first command that you need to run is this contract emit command.<br>This creates the necessary contract.d.js and contract.json files that were needed.<br>Make sure to commit both files as these are used by db.ts.</p><p>As this is the first time we are intializing a table to the db we use this command.</p><pre>npx prisma db init</pre><p>db init creates the table your contract declares. After you run this command migrations will be created and applied as well.</p><p>This was the overall basic setup. Now if you have to add another model or change something inside a existing model you can just change it and then run these two commands after the change.</p><p>As i have told anything you change in contract.prisma the first command to run is ..</p><pre>npx prisma contract emit</pre><p>Then now as we already have intialized the database we are now making changes into it we will be using a different command.</p><pre>npx prisma migration plan --name add_your_customized_name</pre><p>This command compares your new contract with the old contract and makes changes accordingly.<br>At last to synchronize with the database the current migrations. Run</p><pre>npx prisma db migrate</pre><p>db migrate runs only the migrations that the database does not have yet, so here it runs only your change.</p><p>This was the basic setup of Prisma version 8 contract based flow with Nextjs using postgresql.</p><p>Also do</p><p>For More clearer understanding refer this: <a href="https://www.prisma.io/docs/prisma-orm/quickstart/existing-app/postgresql">https://www.prisma.io/docs/prisma-orm/quickstart/existing-app/postgresql</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18d0b18ea4c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>