TOSL
TOSL
Explore posts from servers
DTDrizzle Team
Created by TOSL on 10/27/2024 in #help
.array() can't automatically type cast
export const recurrencePattern = createTable(
"recurrence_pattern",
{
id: serial().primaryKey(),
type: varchar({ length: 50 }).notNull(),
daysOfWeek: integer().array().default(sql`'{}'::integer[]`),
endsAt: timestamp({ withTimezone: true }),
createdAt: timestamp({ withTimezone: true })
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
}
);
export const recurrencePattern = createTable(
"recurrence_pattern",
{
id: serial().primaryKey(),
type: varchar({ length: 50 }).notNull(),
daysOfWeek: integer().array().default(sql`'{}'::integer[]`),
endsAt: timestamp({ withTimezone: true }),
createdAt: timestamp({ withTimezone: true })
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
}
);
PostgresError: column "daysOfWeek" cannot be cast automatically to type integer[]
at ErrorResponse (file:///Users/shawn/dev/rally/node_modules/postgres/src/connection.js:788:26)
at handle (file:///Users/shawn/dev/rally/node_modules/postgres/src/connection.js:474:6)
at TLSSocket.data (file:///Users/shawn/dev/rally/node_modules/postgres/src/connection.js:315:9)
at TLSSocket.emit (node:events:519:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:191:23)
at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
severity_local: 'ERROR',
severity: 'ERROR',
code: '42804',
hint: 'You might need to specify "USING "daysOfWeek"::integer[]".',
file: 'tablecmds.c',
line: '12391',
routine: 'ATPrepAlterColumnType'
}
PostgresError: column "daysOfWeek" cannot be cast automatically to type integer[]
at ErrorResponse (file:///Users/shawn/dev/rally/node_modules/postgres/src/connection.js:788:26)
at handle (file:///Users/shawn/dev/rally/node_modules/postgres/src/connection.js:474:6)
at TLSSocket.data (file:///Users/shawn/dev/rally/node_modules/postgres/src/connection.js:315:9)
at TLSSocket.emit (node:events:519:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:191:23)
at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
severity_local: 'ERROR',
severity: 'ERROR',
code: '42804',
hint: 'You might need to specify "USING "daysOfWeek"::integer[]".',
file: 'tablecmds.c',
line: '12391',
routine: 'ATPrepAlterColumnType'
}
3 replies