Skip to content

Commit

Permalink
fix: createdby & updated by not reference to user table
Browse files Browse the repository at this point in the history
  • Loading branch information
nichenqin committed Aug 24, 2024
1 parent b2bdd83 commit 32e1da8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,11 @@ export class UnderlyingTableFieldVisitor<TB extends CreateTableBuilder<any, any>
this.addColumn(c)
}
createdBy(field: CreatedByField): void {
const user = getTableName(users)
const c = this.tb.addColumn(field.id.value, "text", (b) =>
b.references(`${user}.${users.id.name}`).notNull().onDelete("restrict"),
)
const c = this.tb.addColumn(field.id.value, "text")
this.addColumn(c)
}
updatedBy(field: UpdatedByField): void {
const user = getTableName(users)
const c = this.tb.addColumn(field.id.value, "text", (b) =>
b.references(`${user}.${users.id.name}`).notNull().onDelete("restrict"),
)
const c = this.tb.addColumn(field.id.value, "text")
this.addColumn(c)
}
id(field: IdField): void {
Expand Down
6 changes: 3 additions & 3 deletions packages/trpc/src/trpc.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { tracing } from "@baselime/trpc-opentelemetry-middleware"

import { initTRPC, TRPCError } from "@trpc/server"
import { executionContext, getCurrentUserId } from "@undb/context/server"
import { initTRPC,TRPCError } from "@trpc/server"
import { executionContext,getCurrentUserId } from "@undb/context/server"
import { container } from "@undb/di"
import { createLogger } from "@undb/logger"
import { QUERY_BUILDER, startTransaction, type IQueryBuilder } from "@undb/persistence"
import { QUERY_BUILDER,startTransaction,type IQueryBuilder } from "@undb/persistence"
import { ZodError } from "@undb/zod"
import { fromZodError } from "zod-validation-error"
import pkg from "../package.json"
Expand Down

0 comments on commit 32e1da8

Please sign in to comment.