Enhance npx prisma init: Pre-define basic model in schema.prisma for a smoother prisma studio experience
Bug description
Currently, when running npx prisma init, a user encounters an error message if they attempt to launch prisma studio without defining any models in their schema.prisma file. While the error message clearly guides the user towards defining a model, it can be a minor hurdle for beginners.
Suggestion:
To provide a more seamless experience for new users, consider incorporating a basic model pre-definition within the schema.prisma file generated by npx prisma init. This model could be something simple like:
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
}
Benefits:
- Reduced Friction for New Users: This pre-defined model would allow users to immediately explore prisma studio without encountering the initial error message, streamlining their onboarding journey.
- Learning Opportunity: The basic model serves as a starting point for users to understand the concept of models and schema definition in Prisma. They can then customize or extend this model as their project evolves.
Additional Points:
- Configuration Option: If providing a pre-defined model is deemed unnecessary, consider adding a configuration option within npx prisma init that allows users to choose whether or not to include a basic model.
- Error Handling Improvement: Explore ways to enhance the error message when no models are defined. This could involve providing more specific guidance for defining a model alongside the link to the documentation.
How to reproduce
- Go to your project directory.
- Initialize a new Prisma project:
npx prisma init
3.Start Prisma Studio:
```bash
npx prisma studio
Expected behavior
No response
Prisma information
schema.prisma
// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? // Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
generator client { provider = "prisma-client-js" }
datasource db { provider = "postgresql" url = env("DATABASE_URL") }
Environment & setup
- OS:
- Browser:
- Database: