-
Notifications
You must be signed in to change notification settings - Fork 9
feat(PM-1788): Prisma models for AI workflow #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
846523e
feat: added seeding of provider and llm model
hentrymartin ea269e0
feat: added logic for seeding ai workflow data
hentrymartin 6e335ca
fix: typo
hentrymartin 4dfb067
fix: migration script
hentrymartin 7843edf
fix: migration script
hentrymartin bff5ec8
fix: removed yarn lock file
hentrymartin 8972d58
Merge branch 'develop' into pm-1788
hentrymartin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
prisma/migrations/20250829225539_ai_workflows/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
-- CreateTable | ||
CREATE TABLE "llmProvider" ( | ||
"id" VARCHAR(14) NOT NULL DEFAULT nanoid(), | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"name" VARCHAR NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL, | ||
"createdBy" TEXT NOT NULL, | ||
|
||
CONSTRAINT "llmProvider_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "llmModel" ( | ||
"id" VARCHAR(14) NOT NULL DEFAULT nanoid(), | ||
"providerId" VARCHAR(14) NOT NULL, | ||
"name" VARCHAR NOT NULL, | ||
"description" TEXT NOT NULL, | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"icon" VARCHAR, | ||
"url" VARCHAR, | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"createdBy" TEXT NOT NULL, | ||
|
||
CONSTRAINT "llmModel_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "aiWorkflow" ( | ||
"id" VARCHAR(14) NOT NULL DEFAULT nanoid(), | ||
"name" VARCHAR NOT NULL, | ||
"llmId" VARCHAR(14) NOT NULL, | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"description" TEXT NOT NULL, | ||
"defUrl" VARCHAR NOT NULL, | ||
"gitId" VARCHAR NOT NULL, | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"gitOwner" VARCHAR NOT NULL, | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"scorecardId" VARCHAR(14) NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"createdBy" TEXT NOT NULL, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
"updatedBy" TEXT NOT NULL, | ||
|
||
CONSTRAINT "aiWorkflow_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "aiWorkflowRun" ( | ||
"id" VARCHAR(14) NOT NULL DEFAULT nanoid(), | ||
"workflowId" VARCHAR(14) NOT NULL, | ||
"submissionId" VARCHAR(14) NOT NULL, | ||
"startedAt" TIMESTAMP(3), | ||
"completedAt" TIMESTAMP(3), | ||
"gitRunId" VARCHAR NOT NULL, | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"score" DOUBLE PRECISION, | ||
"status" VARCHAR NOT NULL, | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
CONSTRAINT "aiWorkflowRun_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "aiWorkflowRunItem" ( | ||
"id" VARCHAR(14) NOT NULL DEFAULT nanoid(), | ||
"workflowRunId" VARCHAR(14) NOT NULL, | ||
"scorecardQuestionId" VARCHAR(14) NOT NULL, | ||
"content" TEXT NOT NULL, | ||
"upVotes" INTEGER NOT NULL DEFAULT 0, | ||
"downVotes" INTEGER NOT NULL DEFAULT 0, | ||
"questionScore" DOUBLE PRECISION, | ||
"createdAt" TIMESTAMP(3) NOT NULL, | ||
"createdBy" TEXT NOT NULL, | ||
|
||
CONSTRAINT "aiWorkflowRunItem_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "aiWorkflowRunItemComment" ( | ||
"id" VARCHAR(14) NOT NULL DEFAULT nanoid(), | ||
"workflowRunItemId" VARCHAR(14) NOT NULL, | ||
"userId" TEXT NOT NULL, | ||
"content" TEXT NOT NULL, | ||
"parentId" VARCHAR(14), | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"createdBy" TEXT NOT NULL, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
"updatedBy" TEXT NOT NULL, | ||
|
||
CONSTRAINT "aiWorkflowRunItemComment_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "llmProvider_name_key" ON "llmProvider"("name"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "llmModel_name_key" ON "llmModel"("name"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "aiWorkflow_name_key" ON "aiWorkflow"("name"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "llmModel" ADD CONSTRAINT "llmModel_providerId_fkey" FOREIGN KEY ("providerId") REFERENCES "llmProvider"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "aiWorkflow" ADD CONSTRAINT "aiWorkflow_llmId_fkey" FOREIGN KEY ("llmId") REFERENCES "llmModel"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "aiWorkflow" ADD CONSTRAINT "aiWorkflow_scorecardId_fkey" FOREIGN KEY ("scorecardId") REFERENCES "scorecard"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "aiWorkflowRun" ADD CONSTRAINT "aiWorkflowRun_workflowId_fkey" FOREIGN KEY ("workflowId") REFERENCES "aiWorkflow"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "aiWorkflowRun" ADD CONSTRAINT "aiWorkflowRun_submissionId_fkey" FOREIGN KEY ("submissionId") REFERENCES "submission"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "aiWorkflowRunItem" ADD CONSTRAINT "aiWorkflowRunItem_workflowRunId_fkey" FOREIGN KEY ("workflowRunId") REFERENCES "aiWorkflowRun"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "aiWorkflowRunItem" ADD CONSTRAINT "aiWorkflowRunItem_scorecardQuestionId_fkey" FOREIGN KEY ("scorecardQuestionId") REFERENCES "scorecardQuestion"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "aiWorkflowRunItemComment" ADD CONSTRAINT "aiWorkflowRunItemComment_workflowRunItemId_fkey" FOREIGN KEY ("workflowRunItemId") REFERENCES "aiWorkflowRunItem"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "aiWorkflowRunItemComment" ADD CONSTRAINT "aiWorkflowRunItemComment_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "aiWorkflowRunItemComment"("id") ON DELETE SET NULL ON UPDATE CASCADE; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.