0%
January 5, 2024

Minimal Code for Setting Prisma as Just a Table Migration tool

nodejs

prisma

  • yarn add prisma

  • Create prisma/schema.prisma

    datasource db {
      provider = "postgresql"
      url      = env("DATABASE_URL")
    }
    
    model student {
    // or id     Int    @id @default(autoincrement())
      id         String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
      first_name String
      last_name  String
      email      String
    }
  • Set up a .env

  • Use this env tool if necessary to distinguish different env's.

  • Use these docker file to create a database if necessary for experiment.

  • Use these commonly used commands for table migrations.