Skip to content

Latest commit

 

History

History
39 lines (30 loc) · 1.3 KB

README.md

File metadata and controls

39 lines (30 loc) · 1.3 KB

Examples followed:

To Regenerate Prisma Schema, use:

  1. Remove old database models from schema file: prisma/schema.prisma
  2. Run: ./node_modules/.bin/prisma db pull
  3. Run: ./node_modules/.bin/prisma generate

You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client

import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()

When you want relations in your Prisma types, you have to build it yourself like so:

import { Prisma } from '@prisma/client';

// GET type
type CoinType = Prisma.coinGetPayload<{
  include: {
    country: true;
    ruler: true;
    period: true;
    coin_mint: { include: { mint: true } };
    coin_engraver: { include: { engraver: true } };
    image: true;
  };
}>;

// POST type
coinst coin: Prisma.coinCreateInput = ...