Create the Database and Run Migrations
Create the Database and Run Migrations
The schema is ready. Now turn it into real PostgreSQL tables and keep the database changes tracked in Git.
Task
Create the first migration and apply it to the local database.
Run:
npx prisma migrate dev --name init
Prisma should create a migration under:
prisma/migrations/
Then regenerate the client:
npx prisma generate
Inspect the Database
Open Prisma Studio:
npx prisma studio
Confirm that the main tables/models are present.
You do not need seed data yet. The authentication and application modules will create real records as their workflows are implemented.
Commit the Migration
The generated migration is part of the application source code. Commit it to Git so other environments can recreate the same schema.
Do not commit .env or database credentials.
Test
Run:
npx prisma migrate status
The local database should report that migrations are up to date.
Checkpoint
Readly now has a reproducible PostgreSQL schema. A fresh environment can apply the committed migration instead of manually creating tables.