darian
darian
Explore posts from servers
RRailway
Created by darian on 9/19/2024 in #✋|help
Nextjs redirect to localhost instead of domain
I've deployed several Next.js applications on Railway, but I recently encountered this odd behavior with Response.redirect. Strangely, it redirects to localhost instead of the configured domain. I'm wondering if this issue is related to the latest Next.js update or perhaps with the Railway Edge Proxy. I created a clean new Next.js app for testing, and the problem persists. However, when I deployed it to other platform like Vercel, the issue disappeared. Link to original issue with reproduction: https://help.railway.app/questions/next-js-route-handler-is-returning-local-683ba64f#p-5
6 replies
DTDrizzle Team
Created by darian on 6/24/2024 in #help
Defining disambiguating one-to-one relational query
I'm working with a schema that involves one-to-one disambiguating relationships, and I'm encountering an issue when trying to define these relationships concisely. Here's a simplified version of my schema:
model Transfer {
id String @id
salePayment Sale? @relation("Sale_payment")
saleTax Sale? @relation("Sale_tax")
}

model Sale {
id String @id
payment Transfer @relation("Sale_payment", fields: [paymentId], references: [id])
paymentId String @unique
tax Transfer @relation("Sale_tax", fields: [taxId], references: [id])
taxId String @unique
}
model Transfer {
id String @id
salePayment Sale? @relation("Sale_payment")
saleTax Sale? @relation("Sale_tax")
}

model Sale {
id String @id
payment Transfer @relation("Sale_payment", fields: [paymentId], references: [id])
paymentId String @unique
tax Transfer @relation("Sale_tax", fields: [taxId], references: [id])
taxId String @unique
}
Ideally, I'd like to define the relationships in Transfer by just specifying the relationName, similar to this:
export const transfersRelations = relations(transfers, ({ one }) => ({
salePayment: one(sales, { relationName: "Sale_payment" }),
saleTax: one(sales, { relationName: "Sale_tax" })
}));
export const transfersRelations = relations(transfers, ({ one }) => ({
salePayment: one(sales, { relationName: "Sale_payment" }),
saleTax: one(sales, { relationName: "Sale_tax" })
}));
However, this approach results in a type error, suggesting that specifying only the relationName is not sufficient. The current workaround involves specifying the fields and references explicitly, which makes these fields required:
...
salePayment: one(sales, {
relationName: "Sale_payment"
fields: [transfers.id],
references: [sales.paymentId],
}),
...
...
salePayment: one(sales, {
relationName: "Sale_payment"
fields: [transfers.id],
references: [sales.paymentId],
}),
...
Similarly, one-to-many has solution for this https://orm.drizzle.team/docs/rqb#disambiguating-relations My question is: Is there a way to define these one-to-one disambiguating relationships in Drizzle without making the fields required, preferably using just the relationName? If not, are there any plans to support this kind of concise relationship definition in the future?
4 replies
RRailway
Created by darian on 10/8/2022 in #✋|help
“Sever Error” for Containerized Apollo Router
15 replies