From eac623b9717fb3fc50fa4f61dc04ae5c5ddc0129 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Thu, 16 Nov 2023 19:03:07 -0800 Subject: [PATCH] Made docstring not null --- .../components/src/components/SquigglePlayground/index.tsx | 4 ++-- .../20231116222311_model_export_docstring/migration.sql | 2 -- .../20231117025418_model_export_docstring/migration.sql | 2 ++ packages/hub/prisma/schema.prisma | 2 +- packages/hub/schema.graphql | 2 +- .../hub/src/graphql/mutations/updateSquiggleSnippetModel.ts | 2 +- packages/hub/src/graphql/types/ModelRevision.ts | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) delete mode 100644 packages/hub/prisma/migrations/20231116222311_model_export_docstring/migration.sql create mode 100644 packages/hub/prisma/migrations/20231117025418_model_export_docstring/migration.sql diff --git a/packages/components/src/components/SquigglePlayground/index.tsx b/packages/components/src/components/SquigglePlayground/index.tsx index 7259be7f80..e0b85bc3f8 100644 --- a/packages/components/src/components/SquigglePlayground/index.tsx +++ b/packages/components/src/components/SquigglePlayground/index.tsx @@ -26,7 +26,7 @@ export type ModelExport = { variableName: string; variableType: string; title?: string; - docstring?: string; + docstring: string; }; /* @@ -124,7 +124,7 @@ export const SquigglePlayground: React.FC = ( variableName: e[0], variableType: e[1].tag, title: e[1].title(), - docstring: e[1].context?.docstring() || undefined, + docstring: e[1].context?.docstring() || "", })); onExportsChange && onExportsChange(_exports); } else { diff --git a/packages/hub/prisma/migrations/20231116222311_model_export_docstring/migration.sql b/packages/hub/prisma/migrations/20231116222311_model_export_docstring/migration.sql deleted file mode 100644 index 54945b1fb2..0000000000 --- a/packages/hub/prisma/migrations/20231116222311_model_export_docstring/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "ModelExport" ADD COLUMN "docstring" TEXT; diff --git a/packages/hub/prisma/migrations/20231117025418_model_export_docstring/migration.sql b/packages/hub/prisma/migrations/20231117025418_model_export_docstring/migration.sql new file mode 100644 index 0000000000..e4c7fd9dd3 --- /dev/null +++ b/packages/hub/prisma/migrations/20231117025418_model_export_docstring/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "ModelExport" ADD COLUMN "docstring" TEXT NOT NULL DEFAULT ''; diff --git a/packages/hub/prisma/schema.prisma b/packages/hub/prisma/schema.prisma index 41d5a8109d..54784608a2 100644 --- a/packages/hub/prisma/schema.prisma +++ b/packages/hub/prisma/schema.prisma @@ -235,7 +235,7 @@ model ModelExport { modelRevisionId String variableName String title String? - docstring String? + docstring String @default("") variableType String @default("OTHER") @@unique([modelRevisionId, variableName], name: "uniqueKey") diff --git a/packages/hub/schema.graphql b/packages/hub/schema.graphql index 8a37889b44..4584699564 100644 --- a/packages/hub/schema.graphql +++ b/packages/hub/schema.graphql @@ -154,7 +154,7 @@ type ModelEdge { } type ModelExport implements Node { - docstring: String + docstring: String! id: ID! modelRevision: ModelRevision! title: String diff --git a/packages/hub/src/graphql/mutations/updateSquiggleSnippetModel.ts b/packages/hub/src/graphql/mutations/updateSquiggleSnippetModel.ts index 3436646397..24123c352b 100644 --- a/packages/hub/src/graphql/mutations/updateSquiggleSnippetModel.ts +++ b/packages/hub/src/graphql/mutations/updateSquiggleSnippetModel.ts @@ -164,7 +164,7 @@ builder.mutationField("updateSquiggleSnippetModel", (t) => ({ variableName, variableType, docstring, title }) => ({ variableName, variableType, - docstring: docstring ?? null, + docstring: docstring ?? undefined, title: title ?? null, }) ), diff --git a/packages/hub/src/graphql/types/ModelRevision.ts b/packages/hub/src/graphql/types/ModelRevision.ts index d789985599..8c906505ba 100644 --- a/packages/hub/src/graphql/types/ModelRevision.ts +++ b/packages/hub/src/graphql/types/ModelRevision.ts @@ -22,7 +22,7 @@ builder.prismaNode("ModelExport", { modelRevision: t.relation("modelRevision"), variableName: t.exposeString("variableName"), variableType: t.exposeString("variableType"), - docstring: t.exposeString("docstring", { nullable: true }), + docstring: t.exposeString("docstring"), title: t.exposeString("title", { nullable: true }), }), });