Exercise: Seeding and Migrations
by Tomas Trescak· Databases

0 / 1930 XP
Loading description ...
This time, we have no way of checking whether you have completed your solution or not so please try to complete this assessment and make sure you understand both processes: INSTRUCTIONS 1. Create an empty next.js project npxcreate-next-app@latest prisma-play 2. Initialise Prisma 1.  pnpm i prisma @prisma/client 2. pnpm prisma init 3. Change the provider to sqlite and set the DATABASE_URL in your .env file to file:./dev.db 4. Use the following Schema 5. model Post { id Int @id @default(autoincrement()) title String content String createdAt DateTime @default(now()) } 6. Run the migration pnpm prisma migrate dev --name intial 7. Seed the database with some data 8. Modify the schema as follows: 9. model Post { id Int @id @default(autoincrement()) title String content String createdAt DateTime @default(now()) tags String } 10. Run the migration  11. Could you migrate? If not, can you fix the schema and migrate again! 12. Re-seed the data with new structure 13. Check out changes with prisma studio 14. Roll back the migration  
Maggie

Discuss with Maggie
Use the power of generative AI to interact with course content

Maggie is a generative AI that can help you understand the course content better. You can ask her questions about the lecture, and she will try to answer them. You can also see the questions asked by other students and her responses.

Discuss with Others
Ask questions, share your thoughts, and discuss with other learners

Join the discussion to ask questions, share your thoughts, and discuss with other learners
Setup
React Fundamentals
10 points
Next.js
10 points
Advanced React
Databases
10 points
React Hooks
Authentication and Authorisation
10 points
APIs
CI/CD and DevOps
Testing React
Advanced Topics