Got a question I can’t seem to google my way out o...
# orm-help
j
Got a question I can’t seem to google my way out of, seems quite straightforward I’m trying to do this:
Copy code
async function getLatestBuildByTagAndVersion(tag: string, appVersionId: number) {
const result = prisma.build.findFirst({
  where: {
    component_version: {
      app_version_id: appVersionId,
      git_tag: tag,
      git_sha: "want this from the build.git_sha",
      },
  },
  orderBy: {
    build_number: "desc",
  }
});
Essentially I want git_sha to be:
Copy code
build.git_sha = component_version.git_sha
👀 1
n
Hey Jamie 👋 I’m not 100% sure but this might be possible with the
fieldReference
feature that we have just released in Preview in the last release. Here are the docs for it: https://www.prisma.io/docs/reference/api-reference/prisma-client-reference#compare-columns-in-the-same-table (Also, feel free to share the relevant parts of your Prisma schema, that way it’s easier for everyone to reproduce the problem and help you out 🙂 )
v
👋 @Jamie Higgins did you have a chance to see Niko's answer?
Let us know if this is still an issue for you and if you can share more info about your use case that'd be fantastic!