Successful introspection removes comments from schema.prisma
See original GitHub issueBefore:
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
// The `datasource` block is used to specify the connection to your DB.
// Set the `provider` field to match your DB type: "postgresql", "mysql" or "sqlite".
// The `url` field must contain the connection string to your DB.
// Learn more about connection strings for your DB: https://pris.ly/connection-strings
datasource db {
provider = "sqlite"
url = "sqlite:./chinook.db"
}
// Other examples for connection strings are:
// SQLite: url = "sqlite:./dev.db"
// MySQL: url = "mysql://johndoe:johndoe@localhost:3306/mydb"
// You can also use environment variables to specify the connection string: https://pris.ly/prisma-schema#using-environment-variables
// By adding the `generator` block, you specify that you want to generate Prisma's DB client.
// The client is generated by runnning the `prisma generate` command and will be located in `node_modules/@prisma` and can be imported in your code as:
// import { Prisma Client } from '@prisma/client'
generator client {
provider = "prisma-client-js"
}
// Next steps:
// 1. Add your DB connection string as the `url` of the `datasource` block
// 2. Run `prisma2 introspect` to get your data model into the schema
// 3. Run `prisma2 generate` to generate Prisma Client JS
// 4. Start using Prisma Client JS in your application
After:
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "sqlite"
url = "sqlite:./chinook.db"
}
model albums {
AlbumId Int @id
ArtistId artists
Title String
trackses tracks[] @relation(references: [AlbumId])
}
model artists {
ArtistId Int @id
Name String?
albumses albums[]
}
model customers {
Address String?
City String?
Company String?
Country String?
CustomerId Int @id
Email String
Fax String?
FirstName String
LastName String
Phone String?
PostalCode String?
State String?
SupportRepId employees?
invoiceses invoices[] @relation(references: [CustomerId])
}
model employees {
Address String?
BirthDate DateTime?
City String?
Country String?
Email String?
EmployeeId Int @id
Fax String?
FirstName String
HireDate DateTime?
LastName String
Phone String?
PostalCode String?
ReportsTo employees? @relation("employeesToemployees_ReportsTo")
State String?
Title String?
customerses customers[]
employeeses employees[] @relation("employeesToemployees_ReportsTo")
}
model genres {
GenreId Int @id
Name String?
trackses tracks[] @relation(references: [GenreId])
}
model invoices {
BillingAddress String?
BillingCity String?
BillingCountry String?
BillingPostalCode String?
BillingState String?
CustomerId customers
InvoiceDate DateTime
InvoiceId Int @id
Total Float
invoice_itemses invoice_items[]
}
model invoice_items {
InvoiceId invoices
InvoiceLineId Int @id
Quantity Int
TrackId tracks
UnitPrice Float
}
model media_types {
MediaTypeId Int @id
Name String?
trackses tracks[] @relation(references: [MediaTypeId])
}
model playlists {
Name String?
PlaylistId Int @id
playlist_tracks playlist_track[]
}
model tracks {
AlbumId albums?
Bytes Int?
Composer String?
GenreId genres?
MediaTypeId media_types
Milliseconds Int
Name String
TrackId Int @id
UnitPrice Float
invoice_itemses invoice_items[]
playlist_tracks playlist_track[]
}
model playlist_track {
PlaylistId playlists
TrackId tracks
id Int @id
}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (7 by maintainers)
Top Results From Across the Web
Data model (Reference)
When you introspect a database with a table named comments , the result Prisma model will look like this: model comments {. //...
Read more >Referential actions
Referential actions let you define the update and delete behavior of related models on the database level.
Read more >What is introspection? (Reference)
Introspection has one main function: Populate your Prisma schema with a data model that reflects the current database schema. ... Here's an overview...
Read more >Database Migrations for .NET and Entity Framework with ...
Introduction. In this article, you will learn how to model your data using Prisma, run a migration with Prisma Migrate and then introspect...
Read more >Command Line Interface | RedwoodJS Docs
Appends a DataMigration model to schema.prisma for tracking which data migrations ... where to redirect the user to once their log in/sign up...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
👀 definitely still would be nice to have this, otherwise don’t support comments in the file at all-
There is no original model, so that is not really the point here (although I of course understand the underlying difficulties).