Git Product home page Git Product logo

Comments (1)

dmarticus avatar dmarticus commented on June 2, 2024

I ran into the same issue (I probably did the same thing you did), and after poking around a bit I think I may know what the problem is.

The PlanetScale Prisma adapter is an preview feature, and needs to be enabled thusly in the schema.prisma file. This is by default in the repo when you initially create it (when you run npx create-t3-app@latest, you get a schema.prisma file that looks like this)

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
    provider        = "prisma-client-js"
    previewFeatures = ["driverAdapters"] // this line is what enables the prisma adapters, see https://github.com/prisma/prisma/discussions/21347
}

datasource db {
    provider = "mysql"
    url      = env("DATABASE_URL")
    // If you have enabled foreign key constraints for your database, remove this line.
    relationMode = "prisma"
}

model Post {
    id        Int      @id @default(autoincrement())
    name      String
    createdAt DateTime @default(now())
    updatedAt DateTime @updatedAt
    @@index([name])
}

But, when you go to set up a planetscale DB in the planetscale app, they give you a schema.prisma file to copy into your repo when you initialize your DB, and the schema.prisma file they give you looks like this:

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

datasource db {
  provider     = "mysql"
  url          = env("DATABASE_URL")
  relationMode = "prisma"
}

generator client {
  provider = "prisma-client-js"
  
}

model Post {
  id        Int      @id @default(autoincrement())
  name      String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt

  @@index([name])
}

If the PlanetScale driver adapter isn't enabled, then npm i for those adapter features will fail.

So, the problem here is that the planetscale docs don't include the planetscale driver features by default, and my guess is you copied them over and the install failed (I did the same thing initially!)

If you include the

  previewFeatures = ["driverAdapters"]

in the schema.prisma file, the install should work great. Hope this helps!

from create-t3-app.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.