juan
juan
DTDrizzle Team
Created by juan on 12/12/2024 in #help
Too many nested objs on many-to-many relations
Just to clarify, I dont want to do it programatically
2 replies
DTDrizzle Team
Created by juan on 12/3/2024 in #help
All other relations drop when creating a new one
nvm you shouldn't define relations on one table using two different variables
5 replies
DTDrizzle Team
Created by juan on 12/3/2024 in #help
All other relations drop when creating a new one
No description
5 replies
DTDrizzle Team
Created by juan on 12/3/2024 in #help
All other relations drop when creating a new one
const results = await ctx.db.query.homologations.findMany({
with: {
stateSchema: {
columns: {
id: true,
name: true,
description: true,
}
},
product: true,
},
columns: {
id: true,
createdAt: true,
updatedAt: true,
comments: true,
name: true,
type: true,
},
orderBy: [desc(homologations.updatedAt)]
});
const results = await ctx.db.query.homologations.findMany({
with: {
stateSchema: {
columns: {
id: true,
name: true,
description: true,
}
},
product: true,
},
columns: {
id: true,
createdAt: true,
updatedAt: true,
comments: true,
name: true,
type: true,
},
orderBy: [desc(homologations.updatedAt)]
});
A query like that would return something like
[
{
id: '42093116-0d62-4225-9fa5-a1509262d8f1',
createdAt: 2024-12-03T14:12:22.719Z,
updatedAt: 2024-12-03T14:12:22.719Z,
comments: null,
name: 'nombre homologacion',
type: 'new',
stateSchema: {
id: '42093116-0d62-4225-9fa5-a1509262d8f1',
name: 'nombre esquema',
description: null
},
product: {
id: '5e1eceb0-133a-46dc-972d-82775b4ab35d',
name: 'nombre producto',
brand: 'marca producto',
model: 'modelo producto',
manufacturer: 'fabricante producto',
description: null,
comments: null,
origin: null
}
}
]
[
{
id: '42093116-0d62-4225-9fa5-a1509262d8f1',
createdAt: 2024-12-03T14:12:22.719Z,
updatedAt: 2024-12-03T14:12:22.719Z,
comments: null,
name: 'nombre homologacion',
type: 'new',
stateSchema: {
id: '42093116-0d62-4225-9fa5-a1509262d8f1',
name: 'nombre esquema',
description: null
},
product: {
id: '5e1eceb0-133a-46dc-972d-82775b4ab35d',
name: 'nombre producto',
brand: 'marca producto',
model: 'modelo producto',
manufacturer: 'fabricante producto',
description: null,
comments: null,
origin: null
}
}
]
5 replies
DTDrizzle Team
Created by juan on 12/3/2024 in #help
All other relations drop when creating a new one
Aparently, the schema works just fine, but the properties under with drop
5 replies