Villiam Strandh
DTDrizzle Team
•Created by Villiam Strandh on 1/25/2024 in #help
Relational query error: "Cannot read properties of null (reading 'map')"
export const gisTasks = mysqlTable(
'gis_tasks',
{
id: int('ID').autoincrement().notNull(),
siteNumber: tinyint('SiteNumber').default(1).notNull(),
status: tinyint('Status').default(0).notNull(),
createdDate: datetime('CreatedDate', { mode: 'string' })
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
assignedTo: int('AssignedTo').notNull(),
updatedDate: datetime('UpdatedDate', { mode: 'string' })
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
},
table => {
return {
gisTasksId: primaryKey(table.id),
}
}
)
export const gisAttachments = mysqlTable(
'gis_attachments',
{
id: int('ID').autoincrement().notNull(),
taskId: int('TaskID').notNull(),
updatedDate: datetime('UpdatedDate', { mode: 'string' })
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
userId: int('UserID').default(0).notNull(),
type: int('Type').notNull(),
data: varchar('Data', { length: 255 }).notNull(),
},
table => {
return {
fkGisAttachmentTask: index('FK_gis_attachment_task').on(table.taskId),
gisAttachmentsId: primaryKey(table.id),
}
}
)
export const gisTasks = mysqlTable(
'gis_tasks',
{
id: int('ID').autoincrement().notNull(),
siteNumber: tinyint('SiteNumber').default(1).notNull(),
status: tinyint('Status').default(0).notNull(),
createdDate: datetime('CreatedDate', { mode: 'string' })
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
assignedTo: int('AssignedTo').notNull(),
updatedDate: datetime('UpdatedDate', { mode: 'string' })
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
},
table => {
return {
gisTasksId: primaryKey(table.id),
}
}
)
export const gisAttachments = mysqlTable(
'gis_attachments',
{
id: int('ID').autoincrement().notNull(),
taskId: int('TaskID').notNull(),
updatedDate: datetime('UpdatedDate', { mode: 'string' })
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
userId: int('UserID').default(0).notNull(),
type: int('Type').notNull(),
data: varchar('Data', { length: 255 }).notNull(),
},
table => {
return {
fkGisAttachmentTask: index('FK_gis_attachment_task').on(table.taskId),
gisAttachmentsId: primaryKey(table.id),
}
}
)
3 replies