Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"tailwindCSS.experimental.configFile": "packages/ui/src/styles/globals.css"
"tailwindCSS.experimental.configFile": "packages/ui/src/styles/globals.css",
"prisma.pinToPrisma6": true
}
3 changes: 2 additions & 1 deletion packages/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "./dist/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "prisma generate && tsc -b && cp src/generated/*.node dist/generated/ && cp -r src/generated/runtime dist/generated/",
"build": "prisma generate && tsc -b && mkdir -p dist/generated/runtime && cp src/generated/*.node dist/generated/ || true && cp -r src/generated/runtime/. dist/generated/runtime/",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

❓ Verification inconclusive

|| true masks failures from prisma generate / tsc / mkdir

Because of shell operator associativity, || true applies to the whole prisma generate && tsc -b && mkdir ... && cp ... chain, so failures in earlier steps are silently ignored, not just a missing *.node match.

Consider grouping just the cp:

-    "build": "prisma generate && tsc -b && mkdir -p dist/generated/runtime && cp src/generated/*.node dist/generated/ || true && cp -r src/generated/runtime/. dist/generated/runtime/",
+    "build": "prisma generate && tsc -b && mkdir -p dist/generated/runtime && (cp src/generated/*.node dist/generated/ || true) && cp -r src/generated/runtime/. dist/generated/runtime/",

I'll verify the review comment by checking shell operator precedence and associativity rules.

|| true masks failures from the entire command chain

In bash, AND and OR lists are executed with left associativity, and && and || have equal precedence. This means the command chain parses as:

(prisma generate && tsc -b && mkdir -p dist/generated/runtime && cp src/generated/*.node dist/generated/) || (true && cp -r src/generated/runtime/. dist/generated/runtime/)

When the left side fails (from prisma generate, tsc, or mkdir), true executes and succeeds, allowing the final cp -r to run. This silently swallows build errors.

The proposed fix is correct—wrap only the cp command:

-    "build": "prisma generate && tsc -b && mkdir -p dist/generated/runtime && cp src/generated/*.node dist/generated/ || true && cp -r src/generated/runtime/. dist/generated/runtime/",
+    "build": "prisma generate && tsc -b && mkdir -p dist/generated/runtime && (cp src/generated/*.node dist/generated/ || true) && cp -r src/generated/runtime/. dist/generated/runtime/",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"build": "prisma generate && tsc -b && mkdir -p dist/generated/runtime && cp src/generated/*.node dist/generated/ || true && cp -r src/generated/runtime/. dist/generated/runtime/",
"build": "prisma generate && tsc -b && mkdir -p dist/generated/runtime && (cp src/generated/*.node dist/generated/ || true) && cp -r src/generated/runtime/. dist/generated/runtime/",
🤖 Prompt for AI Agents
In packages/db/package.json around line 8, the build script currently places `||
true` after a long && chain which causes failures earlier in the chain (prisma
generate, tsc, mkdir) to be swallowed; change the script so the `|| true`
applies only to the optional `cp src/generated/*.node ...` step (e.g. run mkdir
-p ... && (cp src/generated/*.node dist/generated/ || true) && cp -r
src/generated/runtime/. dist/generated/runtime/) so build errors are not masked
and the recursive copy still runs.


"dev": "node dist/index.js",
"run": "npm run build && npm run dev"
},
Expand Down
16 changes: 11 additions & 5 deletions packages/db/prisma.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { defineConfig, env } from "prisma/config";
import 'dotenv/config';
import dotenv from "dotenv";

// Load .env when present so env("DATABASE_URL") in schema.prisma resolves
// while using a custom Prisma config file.
// try { require('dotenv/config'); } catch {}
// Explicitly load environment variables from .env if present
dotenv.config();

// Retrieve DATABASE_URL from environment or .env file
const databaseUrl = process.env.DATABASE_URL ?? env("DATABASE_URL");

if (!databaseUrl) {
throw new Error("DATABASE_URL is not defined in environment variables or .env file");
}

export default defineConfig({
schema: "prisma/schema.prisma",
Expand All @@ -12,6 +18,6 @@ export default defineConfig({
},
engine: "classic",
datasource: {
url: env("DATABASE_URL"),
url: databaseUrl,
},
});
117 changes: 61 additions & 56 deletions packages/db/prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,62 +1,31 @@
// 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"
output = "../src/generated"

}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
provider = "postgresql"
url = env("DATABASE_URL")
}

model User {
id String @id @default(cuid())
name String?
email String @unique
password String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
workflow workflow[]
}

model workflow {
id String @id @default(cuid())
name String
createdAt DateTime @default(now())
updateAt DateTime @default(now())
description String
status WorkFlowStatus
userId String
config Json
user User @relation(fields: [userId], references: [id])
TriggerId String @unique
Trigger Triggers @relation(fields: [TriggerId], references: [id])
NodeId String @unique
Node Nodes @relation(fields: [NodeId], references: [id])
}

enum WorkFlowStatus {
Start
Pending
InProgress
ReConnecting
Failed
Completed
id String @id @default(cuid())
name String?
email String @unique
password String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Credentials Credentials[]
Workflow Workflow[]
}

model Triggers {
id String @id @default(cuid())
name String
typeID String
config Json
typeID String
config Json
type AvailableTriggers @relation(fields: [typeID], references: [id])
workflow workflow?
Workflow Workflow?
}

model AvailableTriggers {
Expand All @@ -68,19 +37,55 @@ model AvailableTriggers {
}

model AvailableNodes {
id String @id @default(cuid())
name String
typeId String @unique
config Json
Node Nodes[]
id String @id @default(cuid())
name String
typeId String @unique
config Json
Node Nodes[]
}

model Nodes {
id String @id @default(cuid())
name String
workflow workflow?
typeId String
type AvailableNodes @relation(fields: [typeId], references: [id])
config Json
position Int
id String @id @default(cuid())
name String
typeId String
config Json
position Int
Credentials Credentials[]
type AvailableNodes @relation(fields: [typeId], references: [id])
Workflow Workflow?
}

model Credentials {
id String @id
userId String
type String
config Json
nodeId String?
Nodes Nodes? @relation(fields: [nodeId], references: [id])
User User @relation(fields: [userId], references: [id])
}

model Workflow {
id String @id
name String
createdAt DateTime @default(now())
updateAt DateTime @default(now())
description String
status WorkFlowStatus
userId String
config Json
TriggerId String @unique
NodeId String @unique
Nodes Nodes @relation(fields: [NodeId], references: [id])
Triggers Triggers @relation(fields: [TriggerId], references: [id])
User User @relation(fields: [userId], references: [id])
}
Comment on lines +58 to +82

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Fix likely typo on Workflow.updateAt and consider ID defaults

In Workflow:

  • updateAt is probably meant to be updatedAt and to mirror the User.updatedAt behavior. As written, it’s just a normal DateTime with a creation default and won’t auto-update on row updates.

Suggested adjustment:

model Workflow {
  id          String         @id
  name        String
  createdAt   DateTime       @default(now())
  updatedAt   DateTime       @updatedAt
  // ...
}

Optionally, if you don’t rely on externally provided IDs, you may also want @default(cuid()) (or @default(uuid())) on Workflow.id and Credentials.id for consistency with other models.



---

🏁 Script executed:

```shell
#!/bin/bash
# Read the full Prisma schema to verify the issues mentioned in the review
cat packages/db/prisma/schema.prisma

Length of output: 2103


🏁 Script executed:

#!/bin/bash
# Check if there are other models with ID fields to understand the pattern
rg -n '@id|@default' packages/db/prisma/schema.prisma

Length of output: 446


Fix typo updateAtupdatedAt and add missing @updatedat directive and ID defaults

In Workflow (lines 69-72):

  • updateAt is a typo; should be updatedAt
  • Use @updatedAt directive instead of @default(now()) to auto-update the timestamp on row changes, matching the User model pattern

In Credentials (line 59) and Workflow (line 69):

  • Both ID fields lack @default(cuid()), inconsistent with all other models in the schema
model Credentials {
  id     String  @id @default(cuid())
  // ...
}

model Workflow {
  id          String         @id @default(cuid())
  name        String
  createdAt   DateTime       @default(now())
  updatedAt   DateTime       @updatedAt
  // ...
}
🤖 Prompt for AI Agents
packages/db/prisma/schema.prisma lines 58-82: The Workflow model has a typo
`updateAt` which should be `updatedAt` and should use the @updatedAt directive
instead of @default(now()), and both Credentials.id and Workflow.id are missing
@default(cuid()) to match other models; update Workflow: rename `updateAt` →
`updatedAt` and replace @default(now()) with @updatedAt, and add
@default(cuid()) to the id fields for both Credentials and Workflow models so
IDs are generated consistently.


enum WorkFlowStatus {
Start
Pending
InProgress
ReConnecting
Failed
Completed
}
49 changes: 0 additions & 49 deletions packages/db/src/generated/browser.ts

This file was deleted.

76 changes: 0 additions & 76 deletions packages/db/src/generated/client.ts

This file was deleted.

Loading