Skip to content

Commit

Permalink
fix: deprecated drizzle pgTable usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Gi-jutsu committed Dec 13, 2024
1 parent d769540 commit d78efb1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
16 changes: 6 additions & 10 deletions src/identity-and-access/infrastructure/drizzle/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ export const accountSchema = pgTable(
.notNull()
.$defaultFn(() => new Date()),
},
(table) => ({
emailUniqueIndex: uniqueIndex("emailUniqueIndex").on(
sql`lower(${table.email})`
),
})
(table) => [uniqueIndex("emailUniqueIndex").on(sql`lower(${table.email})`)]
);

export const ForgotPasswordRequestSchema = pgTable(
Expand All @@ -45,11 +41,11 @@ export const ForgotPasswordRequestSchema = pgTable(
.notNull()
.$defaultFn(() => new Date()),
},
(table) => ({
uniqueAccountForgotPasswordRequest: uniqueIndex(
"idx_unique_account_forgot_password_request"
).on(table.accountId),
})
(table) => [
uniqueIndex("idx_unique_account_forgot_password_request").on(
table.accountId
),
]
);

export type IdentityAndAccessDatabase = NodePgDatabase<{
Expand Down
16 changes: 7 additions & 9 deletions src/shared-kernel/infrastructure/drizzle/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ export const outboxMessageSchema = pgTable(
processedAt: timestamp("processed_at"),
errorMessage: varchar("error_message"),
},
(table) => {
return {
idx_outbox_messages_unprocessed: index("idx_outbox_messages_unprocessed")
.on(table.occurredAt, table.processedAt)
// @FIXME PostgreSQL 'INCLUDE' is not supported by drizzle-orm
// @see https://github.com/drizzle-team/drizzle-orm/issues/2972
.where(isNull(table.processedAt)),
};
}
(table) => [
index("idx_outbox_messages_unprocessed")
.on(table.occurredAt, table.processedAt)
// @FIXME PostgreSQL 'INCLUDE' is not supported by drizzle-orm
// @see https://github.com/drizzle-team/drizzle-orm/issues/2972
.where(isNull(table.processedAt)),
]
);

export type SharedKernelDatabase = NodePgDatabase<{
Expand Down

0 comments on commit d78efb1

Please sign in to comment.