Skip to content

Commit

Permalink
Add comments explaining that the schema files are generated in the sc…
Browse files Browse the repository at this point in the history
…hema files (#6397)
  • Loading branch information
emmatown authored Aug 23, 2021
1 parent f65cf67 commit c76bfc0
Show file tree
Hide file tree
Showing 57 changed files with 177 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/fresh-spies-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/keystone': patch
---

Added a comment in the `schema.prisma` and `schema.graphql` files explaining that they're generated and should not be modified manually.
3 changes: 3 additions & 0 deletions examples-staging/assets-cloud/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type Post {
id: ID!
title: String
Expand Down
3 changes: 3 additions & 0 deletions examples-staging/assets-cloud/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples-staging/assets-local/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type Post {
id: ID!
title: String
Expand Down
3 changes: 3 additions & 0 deletions examples-staging/assets-local/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples-staging/auth/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

input CreateInitialUserInput {
name: String
email: String
Expand Down
3 changes: 3 additions & 0 deletions examples-staging/auth/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples-staging/basic/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type RandomNumber {
number: Int
generatedAt: Int
Expand Down
3 changes: 3 additions & 0 deletions examples-staging/basic/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples-staging/ecommerce/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type Mutation {
addToCart(productId: ID): CartItem
checkout(token: String!): Order
Expand Down
3 changes: 3 additions & 0 deletions examples-staging/ecommerce/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples-staging/embedded-nextjs/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type Post {
id: ID!
title: String
Expand Down
3 changes: 3 additions & 0 deletions examples-staging/embedded-nextjs/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples-staging/graphql-api-endpoint/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

input CreateInitialUserInput {
name: String
email: String
Expand Down
3 changes: 3 additions & 0 deletions examples-staging/graphql-api-endpoint/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource postgresql {
url = env("DATABASE_URL")
provider = "postgresql"
Expand Down
3 changes: 3 additions & 0 deletions examples-staging/playground/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type Note {
id: ID!
label: String
Expand Down
3 changes: 3 additions & 0 deletions examples-staging/playground/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples-staging/roles/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

input CreateInitialPersonInput {
name: String
email: String
Expand Down
3 changes: 3 additions & 0 deletions examples-staging/roles/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples-staging/sandbox/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type Todo {
id: ID!
label: String
Expand Down
3 changes: 3 additions & 0 deletions examples-staging/sandbox/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples/blog/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type Post {
id: ID!
title: String
Expand Down
3 changes: 3 additions & 0 deletions examples/blog/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples/custom-admin-ui-logo/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type Task {
id: ID!
label: String
Expand Down
3 changes: 3 additions & 0 deletions examples/custom-admin-ui-logo/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples/custom-admin-ui-navigation/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type Task {
id: ID!
label: String
Expand Down
3 changes: 3 additions & 0 deletions examples/custom-admin-ui-navigation/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples/custom-admin-ui-pages/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type Task {
id: ID!
label: String
Expand Down
3 changes: 3 additions & 0 deletions examples/custom-admin-ui-pages/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples/custom-field-view/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type Task {
id: ID!
label: String
Expand Down
3 changes: 3 additions & 0 deletions examples/custom-field-view/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples/custom-field/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type Post {
id: ID!
title: String
Expand Down
3 changes: 3 additions & 0 deletions examples/custom-field/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples/default-values/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type Task {
id: ID!
label: String
Expand Down
3 changes: 3 additions & 0 deletions examples/default-values/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples/document-field/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type Post {
id: ID!
title: String
Expand Down
3 changes: 3 additions & 0 deletions examples/document-field/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples/extend-graphql-schema/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type Mutation {
"""
Publish a post
Expand Down
3 changes: 3 additions & 0 deletions examples/extend-graphql-schema/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples/json/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type Package {
id: ID!
label: String
Expand Down
3 changes: 3 additions & 0 deletions examples/json/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples/task-manager/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type Task {
id: ID!
label: String
Expand Down
3 changes: 3 additions & 0 deletions examples/task-manager/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples/testing/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

input CreateInitialPersonInput {
name: String
email: String
Expand Down
3 changes: 3 additions & 0 deletions examples/testing/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples/virtual-field/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type Post {
id: ID!
title: String
Expand Down
3 changes: 3 additions & 0 deletions examples/virtual-field/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions examples/with-auth/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

input CreateInitialPersonInput {
name: String
email: String
Expand Down
3 changes: 3 additions & 0 deletions examples/with-auth/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
7 changes: 6 additions & 1 deletion packages/keystone/src/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ export async function getCommittedArtifacts(
'node_modules/.prisma/client'
);
return {
graphql: format(printSchema(graphQLSchema), { parser: 'graphql' }),
graphql: format(
'# This file is automatically generated by Keystone, do not modify it manually.\n' +
'# Modify your Keystone config when you want to change this.\n\n' +
printSchema(graphQLSchema),
{ parser: 'graphql' }
),
prisma: await formatSchema({
schema: prismaSchema,
}),
Expand Down
5 changes: 4 additions & 1 deletion packages/keystone/src/lib/core/prisma-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,10 @@ export function printPrismaSchema(
provider: DatabaseProvider,
clientDir: string
) {
let prismaSchema = `datasource ${provider} {
let prismaSchema = `// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.
datasource ${provider} {
url = env("DATABASE_URL")
provider = "${provider}"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type Todo {
id: ID!
title: String
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
3 changes: 3 additions & 0 deletions tests/test-projects/basic/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is automatically generated by Keystone, do not modify it manually.
# Modify your Keystone config when you want to change this.

type Task {
id: ID!
label: String
Expand Down
3 changes: 3 additions & 0 deletions tests/test-projects/basic/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.

datasource sqlite {
url = env("DATABASE_URL")
provider = "sqlite"
Expand Down
Loading

0 comments on commit c76bfc0

Please sign in to comment.