$chiubaca / notes / fleeting / 2021-04-02
  • Learning about the basics of Prisma 2. The slightly confusing thing about Prisma 2 is that is many things, itโ€™s worth understanding that it is totally different product to Prisma 1. Not drilled into the difference between the two product but some useful information here.

  • What I understand about Prisma 2 so far.

    • It currently supports PostgreSQL, My SQL and SQL Lite. MongoDB support coming soon.
    • DB schemas are defined using a schema.prsisma file which uses graphql-like syntax.
    • In here the db source is defined with datasource
    • The rest of the db schemas can also be defined in their own model blocks. There are lots of additional attributes/directives/modifers that can be used, so that you have more control over the feild types and creating relationships with other tables.
    • Once schemas are defined you need to run prisma migrate which will create real db schemas based on what was provided in the prisma.schema file. It will handle db migrations too.
    • When working with Prisma in node, you will be using the @prisma/client. Under the hood , the client knows to read the prisma.schema and generate a client that is tailored to your models.
    • The prisma client can thought of as a query model builder.
Edit on GitHub โœ๏ธ

Hey I'm Alex Chiu ๐Ÿ‘‹. These are my notes for literally anything.

I'm using the Zettelkasten method to organise my thoughts here.

My more polished writings are published to my main blog at chiubaca.com

Follow me on: Github / X (Twitter) / Mastodon / LinkedIn