Database

Database

CodePilot uses Prisma to interact with the database. You can find the configuration in the prisma/schema.prisma file.

// This is your Prisma schema file,

generator client {
  provider = "prisma-client-js"
}

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

Update the database URL in the DATABASE_URL environment variable in the .env.local file. Also update the direct URL in the DIRECT_URL environment variable in the .env.local file.

Then run the following command to generate the Prisma client:

yarn prisma generate

After this push the schema to the database:

yarn prisma db push

or if you want to do both options in one command:

yarn prisma  migrate dev --name name_of_migration
 

Now you can see the database in the Prisma Studio:

yarn prisma studio