PGT
PGT
DTDrizzle Team
Created by PGT on 12/6/2023 in #help
drizzle-kit not detecting tsconfig and getting path alias '~/'
i guess for the schema file, i can use relative paths, feels cleaner the rest of the app is already working with absolute paths, so should be just the one file
10 replies
DTDrizzle Team
Created by PGT on 12/6/2023 in #help
drizzle-kit not detecting tsconfig and getting path alias '~/'
oh so basically just use the --project flag?
10 replies
DTDrizzle Team
Created by PGT on 12/6/2023 in #help
drizzle-kit not detecting tsconfig and getting path alias '~/'
basically it can't detect the types file: Error: Cannot find module '~/types'
10 replies
DTDrizzle Team
Created by PGT on 12/6/2023 in #help
drizzle-kit not detecting tsconfig and getting path alias '~/'
pthieu@Phongs-M1:~/www/commit-playground (main)% pn db:push

> clipshine@0.1.0 db:push /Users/pthieu/www/commit-playground
> drizzle-kit push:pg --config=drizzle.config.ts

drizzle-kit: v0.19.13
drizzle-orm: v0.28.6

Custom config path was provided, using 'drizzle.config.ts'
Reading config file '/Users/pthieu/www/commit-playground/drizzle.config.ts'
Error: Cannot find module '~/types'
Require stack:
- /Users/pthieu/www/commit-playground/src/db/schema/index.ts
- /Users/pthieu/www/commit-playground/node_modules/.pnpm/drizzle-kit@0.19.13/node_modules/drizzle-kit/index.cjs
at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
at Module._load (node:internal/modules/cjs/loader:922:27)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:119:18)
at Object.<anonymous> (/Users/pthieu/www/commit-playground/src/db/schema/index.ts:14:34)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._compile (/Users/pthieu/www/commit-playground/node_modules/.pnpm/drizzle-kit@0.19.13/node_modules/drizzle-kit/index.cjs:8623:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Object.newLoader [as .ts] (/Users/pthieu/www/commit-playground/node_modules/.pnpm/drizzle-kit@0.19.13/node_modules/drizzle-kit/index.cjs:8627:13)
at Module.load (node:internal/modules/cjs/loader:1119:32) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/pthieu/www/commit-playground/src/db/schema/index.ts',
'/Users/pthieu/www/commit-playground/node_modules/.pnpm/drizzle-kit@0.19.13/node_modules/drizzle-kit/index.cjs'
]
}
pthieu@Phongs-M1:~/www/commit-playground (main)% pn db:push

> clipshine@0.1.0 db:push /Users/pthieu/www/commit-playground
> drizzle-kit push:pg --config=drizzle.config.ts

drizzle-kit: v0.19.13
drizzle-orm: v0.28.6

Custom config path was provided, using 'drizzle.config.ts'
Reading config file '/Users/pthieu/www/commit-playground/drizzle.config.ts'
Error: Cannot find module '~/types'
Require stack:
- /Users/pthieu/www/commit-playground/src/db/schema/index.ts
- /Users/pthieu/www/commit-playground/node_modules/.pnpm/drizzle-kit@0.19.13/node_modules/drizzle-kit/index.cjs
at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
at Module._load (node:internal/modules/cjs/loader:922:27)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:119:18)
at Object.<anonymous> (/Users/pthieu/www/commit-playground/src/db/schema/index.ts:14:34)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._compile (/Users/pthieu/www/commit-playground/node_modules/.pnpm/drizzle-kit@0.19.13/node_modules/drizzle-kit/index.cjs:8623:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Object.newLoader [as .ts] (/Users/pthieu/www/commit-playground/node_modules/.pnpm/drizzle-kit@0.19.13/node_modules/drizzle-kit/index.cjs:8627:13)
at Module.load (node:internal/modules/cjs/loader:1119:32) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/pthieu/www/commit-playground/src/db/schema/index.ts',
'/Users/pthieu/www/commit-playground/node_modules/.pnpm/drizzle-kit@0.19.13/node_modules/drizzle-kit/index.cjs'
]
}
10 replies
DTDrizzle Team
Created by PGT on 12/6/2023 in #help
drizzle-kit not detecting tsconfig and getting path alias '~/'
one sec let me get the error
10 replies
DTDrizzle Team
Created by PGT on 12/6/2023 in #help
drizzle-kit not detecting tsconfig and getting path alias '~/'
oh my god I forgot the most important piece of information lol
10 replies
DTDrizzle Team
Created by PGT on 11/17/2023 in #help
varchar but cast to typescript enum?
@Angelelz looks like this is what i need, will try it out, thanks!
4 replies
DTDrizzle Team
Created by PGT on 9/29/2023 in #help
update where multiple conditions
still gives me the Type 'boolean' is not assignable to type 'SQLWrapper' type error abovee
27 replies
DTDrizzle Team
Created by PGT on 9/29/2023 in #help
update where multiple conditions
actually do you mean I have to explicitly define an object with the col names i'll update? like this?
export function update(
data: Partial<NewProjectRender>,
conditions: { renderId: string; projectId: string },
) {
const query = db
.update(Table)
.set(data)
.where(
and(
...Object.entries(conditions).map(([key, value]) =>
eq(Table[key as keyof typeof Table], value),
),
),
);
return query;
}
export function update(
data: Partial<NewProjectRender>,
conditions: { renderId: string; projectId: string },
) {
const query = db
.update(Table)
.set(data)
.where(
and(
...Object.entries(conditions).map(([key, value]) =>
eq(Table[key as keyof typeof Table], value),
),
),
);
return query;
}
27 replies
DTDrizzle Team
Created by PGT on 9/29/2023 in #help
update where multiple conditions
even with your last snipppet above, i get have the type error: Type 'boolean' is not assignable to type 'SQLWrapper'
27 replies
DTDrizzle Team
Created by PGT on 9/29/2023 in #help
update where multiple conditions
yeah, it does, i just get the type error
27 replies
DTDrizzle Team
Created by PGT on 9/29/2023 in #help
update where multiple conditions
yeah, I'm using it something like this:
import {update} from '...'

update(data, {renderId: 'some id', projectId: 'project id'})
import {update} from '...'

update(data, {renderId: 'some id', projectId: 'project id'})
which should be defined cols of ProjectRenderTable
27 replies
DTDrizzle Team
Created by PGT on 9/29/2023 in #help
update where multiple conditions
ideally i want to use import update and invoke it with different conditions so i'm thinking it makes sense here don't mind changing it elsewhere though
27 replies
DTDrizzle Team
Created by PGT on 9/29/2023 in #help
update where multiple conditions
only tried to explicitly define it in the signature, so something like
export function update(data: Partial<NewProjectRender>, conditions: Partial<NewProjectRender>)
export function update(data: Partial<NewProjectRender>, conditions: Partial<NewProjectRender>)
27 replies
DTDrizzle Team
Created by PGT on 9/29/2023 in #help
update where multiple conditions
i've also tried eq(ProjectRenderTable[key as keyof typeof ProjectRenderTable], value), somewhat of a different error
No overload matches this call.
Overload 1 of 3, '(left: Column<ColumnBaseConfig<ColumnDataType, string>, object, object>, right: unknown): SQL<unknown>', gave the following error.
Argument of type 'boolean | PgColumn<{ name: "id"; tableName: "project_renders"; dataType: "string"; columnType: "PgUUID"; data: string; driverParam: string; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, {}, {}> | ... 12 more ... | { ...; }' is not assignable to parameter of type 'Column<ColumnBaseConfig<ColumnDataType, string>, object, object>'.
Type 'boolean' is not assignable to type 'Column<ColumnBaseConfig<ColumnDataType, string>, object, object>'.
Overload 2 of 3, '(left: Aliased<unknown>, right: unknown): SQL<unknown>', gave the following error.
Argument of type 'boolean | PgColumn<{ name: "id"; tableName: "project_renders"; dataType: "string"; columnType: "PgUUID"; data: string; driverParam: string; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, {}, {}> | ... 12 more ... | { ...; }' is not assignable to parameter of type 'Aliased<unknown>'.
Type 'boolean' is not assignable to type 'Aliased<unknown>'.
Overload 3 of 3, '(left: SQLWrapper, right: unknown): SQL<unknown>', gave the following error.
Argument of type 'boolean | PgColumn<{ name: "id"; tableName: "project_renders"; dataType: "string"; columnType: "PgUUID"; data: string; driverParam: string; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, {}, {}> | ... 12 more ... | { ...; }' is not assignable to parameter of type 'SQLWrapper'.
Type 'boolean' is not assignable to type 'SQLWrapper'.
No overload matches this call.
Overload 1 of 3, '(left: Column<ColumnBaseConfig<ColumnDataType, string>, object, object>, right: unknown): SQL<unknown>', gave the following error.
Argument of type 'boolean | PgColumn<{ name: "id"; tableName: "project_renders"; dataType: "string"; columnType: "PgUUID"; data: string; driverParam: string; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, {}, {}> | ... 12 more ... | { ...; }' is not assignable to parameter of type 'Column<ColumnBaseConfig<ColumnDataType, string>, object, object>'.
Type 'boolean' is not assignable to type 'Column<ColumnBaseConfig<ColumnDataType, string>, object, object>'.
Overload 2 of 3, '(left: Aliased<unknown>, right: unknown): SQL<unknown>', gave the following error.
Argument of type 'boolean | PgColumn<{ name: "id"; tableName: "project_renders"; dataType: "string"; columnType: "PgUUID"; data: string; driverParam: string; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, {}, {}> | ... 12 more ... | { ...; }' is not assignable to parameter of type 'Aliased<unknown>'.
Type 'boolean' is not assignable to type 'Aliased<unknown>'.
Overload 3 of 3, '(left: SQLWrapper, right: unknown): SQL<unknown>', gave the following error.
Argument of type 'boolean | PgColumn<{ name: "id"; tableName: "project_renders"; dataType: "string"; columnType: "PgUUID"; data: string; driverParam: string; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, {}, {}> | ... 12 more ... | { ...; }' is not assignable to parameter of type 'SQLWrapper'.
Type 'boolean' is not assignable to type 'SQLWrapper'.
27 replies
DTDrizzle Team
Created by PGT on 9/29/2023 in #help
update where multiple conditions
i've tried a few different types, still same error
27 replies
DTDrizzle Team
Created by PGT on 9/29/2023 in #help
update where multiple conditions
should be Partial<NewProjectRender> i'm using it to find specific rows to update
27 replies
DTDrizzle Team
Created by PGT on 9/29/2023 in #help
update where multiple conditions
ProjectRenderTable is the pgTable definition from the schema
export const ProjectRenderTable = pgTable('project_renders', {
id: uuid('id').primaryKey().defaultRandom(),
projectId: uuid('project_id')
.references(() => ProjectTable.id)
.notNull(),
renderId: varchar('render_id', { length: 64 }).notNull(),
status: varchar('status', { length: 32 }).notNull(),
renderTime: integer('render_time'),
outputUrl: text('output_url'),
cost: doublePrecision('cost'),
errors: customJsonb<Record<string, string>[]>('errors'),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow(),
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow(),
});
export const ProjectRenderTable = pgTable('project_renders', {
id: uuid('id').primaryKey().defaultRandom(),
projectId: uuid('project_id')
.references(() => ProjectTable.id)
.notNull(),
renderId: varchar('render_id', { length: 64 }).notNull(),
status: varchar('status', { length: 32 }).notNull(),
renderTime: integer('render_time'),
outputUrl: text('output_url'),
cost: doublePrecision('cost'),
errors: customJsonb<Record<string, string>[]>('errors'),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow(),
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow(),
});
27 replies
DTDrizzle Team
Created by PGT on 9/29/2023 in #help
update where multiple conditions
tried a few variations of the key as keyof... with different types without success also tried to mess with the conditions type a bit
27 replies
DTDrizzle Team
Created by PGT on 9/29/2023 in #help
update where multiple conditions
No description
27 replies