PresentationInteractive, narrated presentation of the section content.

ContentDetailed description of the section content.

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

 

No hints available.

Discuss with OthersAsk questions, share your thoughts, and discuss with other learners.

Loading discussion ...