Studio issue with ::
Here's an interesting scenario. I'm using sveltekit and supabase. I was able to get everything set up fine. established three tables - introspect worked great - generated the schema - no issues. Loaded up another 35 tables - and now I'm running into this error when I try to pull up studio:
node:internal/process/promises:289
triggerUncaughtException(err, true /* fromPromise */);
^
Error: Transform failed with 1 error:
/src/lib/server/db/schema.ts:49:60: ERROR: Expected ")" but found ":"
at failureErrorWithLog (/node_modules/esbuild/lib/main.js:1646:15)
at /node_modules/esbuild/lib/main.js:847:29
at responseCallbacks.<computed> (/node_modules/esbuild/lib/main.js:703:9)
at handleIncomingPacket (/node_modules/esbuild/lib/main.js:762:9)
at Socket.readFromStdout (/node_modules/esbuild/lib/main.js:679:7)
at Socket.emit (node:events:514:28)
at addChunk (node:internal/streams/readable:343:12)
at readableAddChunk (node:internal/streams/readable:316:9)
at Readable.push (node:internal/streams/readable:253:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23) {
errors: [
{
detail: undefined,
id: '',
location: {
column: 60,
file: '/src/lib/server/db/schema.ts',
length: 1,
line: 49,
lineText: '\tcontactId: text("contact_id").default(substr(md5((random())::text), 1, 10)).primaryKey().notNull(),',
namespace: '',
suggestion: ')'
},
notes: [],
pluginName: '',
text: 'Expected ")" but found ":"'
}
],
warnings: []
}
Node.js v20.5.1
Any thoughts on this error?
1 Reply
so - I figured out the issue - Supabase was automatically putting in the text - so what I was doing was creating the error.
Here's what I typed in:
(substr(md5((random())::text), 1, 10)
This worked fine in Supabase - but when Studio read the file - it got confused. Here's what made Studio happy:
(substr(md5((random())), 1, 10)
Essentially the same thing since Supabase automatically knew it was a text field - but it cleaned it up for Studio to read.