Problem with AT TIME ZONE

When running drizzle-kit studio, I got error with following generated schema file (from supabase):
createdAt: timestamp("created_at", { mode: 'string' }).default((now() AT TIME ZONE 'utc'::text)),
createdAt: timestamp("created_at", { mode: 'string' }).default((now() AT TIME ZONE 'utc'::text)),
errors: [
{
detail: undefined,
id: '',
location: {
column: 71,
file: '/Users/app/repository/drizzle/schema.ts',
length: 2,
line: 35,
lineText: `\tcreatedAt: timestamp("created_at", { mode: 'string' }).default((now() AT TIME ZONE 'utc'::text)),`,
namespace: '',
suggestion: ')'
},
notes: [],
pluginName: '',
text: 'Expected ")" but found "AT"'
}
],
warnings: []
errors: [
{
detail: undefined,
id: '',
location: {
column: 71,
file: '/Users/app/repository/drizzle/schema.ts',
length: 2,
line: 35,
lineText: `\tcreatedAt: timestamp("created_at", { mode: 'string' }).default((now() AT TIME ZONE 'utc'::text)),`,
namespace: '',
suggestion: ')'
},
notes: [],
pluginName: '',
text: 'Expected ")" but found "AT"'
}
],
warnings: []
10 Replies
Sillvva
Sillvva7mo ago
createdAt: timestamp("created_at", { mode: 'string' }).default(sql`(now() AT TIME ZONE 'utc'::text)`),
createdAt: timestamp("created_at", { mode: 'string' }).default(sql`(now() AT TIME ZONE 'utc'::text)`),
revskill
revskillOP7mo ago
@Sillvva This problem is when i use db pull, the generated file contains above error.
Sillvva
Sillvva7mo ago
The error above is pointing at an issue in the schema file, because .default((now() AT TIME ZONE 'utc'::text)) is not valid JavaScript. It's a JS syntax error starting at the AT.
revskill
revskillOP7mo ago
@Sillvva Correct. It's the issue with generated schema.ts file after i run drizzle-kit pull
Sillvva
Sillvva7mo ago
If that's exactly how the schema was generated, then it is likely a bug. @Andrew Sherman @alexblokh
revskill
revskillOP7mo ago
@Sillvva Yes, you can reproduce by: - Create column with timezone set to utc as above. - drizzle-kit introspect:pg
Andrii Sherman
Andrii Sherman7mo ago
got it, we will fix it
Stefano Sandes
Stefano Sandes7mo ago
Many related errors. Drizzle Studio is generating a schema for every schema in supabase. Is this intentional?
No description
revskill
revskillOP7mo ago
Thanks for pointing out. Currently i can't open Studio from the generated supabase schema though.
Andrii Sherman
Andrii Sherman7mo ago
сс @⚡Z.E.U.S⚡
Want results from more Discord servers?
Add your server