xvx
xvx
Explore posts from servers
DTDrizzle Team
Created by xvx on 6/12/2024 in #help
How to dynamically set a row value using data from a JS object? (onConflictDoUpdate)
The schema looks like it's properly constrained to me:
export const financialAccountTable = pgTable("financial_account", {
organisationId: uuid("organisation_id")
.notNull()
.references(() => organisationTable.organisationId, { onDelete: "cascade" }),
financialAccountId: uuid("financial_account_id")
.primaryKey()
.unique()
.notNull(),
financialAccountName: text("financial_account_name").notNull(),
financialAccountType: text("financial_account_type")
.notNull(),
financialAccountClass: text("financial_account_class")
.notNull(),
price: decimal("price").notNull(),
customId: uuid("custom_id")
.unique(),
customName: text(
"custom_name",
).unique(),
});
export const financialAccountTable = pgTable("financial_account", {
organisationId: uuid("organisation_id")
.notNull()
.references(() => organisationTable.organisationId, { onDelete: "cascade" }),
financialAccountId: uuid("financial_account_id")
.primaryKey()
.unique()
.notNull(),
financialAccountName: text("financial_account_name").notNull(),
financialAccountType: text("financial_account_type")
.notNull(),
financialAccountClass: text("financial_account_class")
.notNull(),
price: decimal("price").notNull(),
customId: uuid("custom_id")
.unique(),
customName: text(
"custom_name",
).unique(),
});
13 replies
DTDrizzle Team
Created by xvx on 6/12/2024 in #help
How to dynamically set a row value using data from a JS object? (onConflictDoUpdate)
yep, the values object:
{
organisationId: '7b28dcbd-1f0c-4c00-b176-2e03356c6c3e',
financialAccountId: '970374f4-f594-41c1-a838-2c3a930e320b',
financialAccountName: 'x',
financialAccountClass: 'revenue',
financialAccountType: 'revenue',
price: '19994.12'
},
{
organisationId: '7b28dcbd-1f0c-4c00-b176-2e03356c6c3e',
financialAccountId: '2588eeb2-07bf-45cc-aebc-df3776dbf5ed',
financialAccountName: 'y',
financialAccountClass: 'revenue',
financialAccountType: 'revenue',
price: '95448.05'
},
{
organisationId: '7b28dcbd-1f0c-4c00-b176-2e03356c6c3e',
financialAccountId: '6f665285-27cf-45e2-a16a-6ab31be6a874',
financialAccountName: 'z',
financialAccountClass: 'revenue',
financialAccountType: 'revenue',
price: '64717.97'
}
{
organisationId: '7b28dcbd-1f0c-4c00-b176-2e03356c6c3e',
financialAccountId: '970374f4-f594-41c1-a838-2c3a930e320b',
financialAccountName: 'x',
financialAccountClass: 'revenue',
financialAccountType: 'revenue',
price: '19994.12'
},
{
organisationId: '7b28dcbd-1f0c-4c00-b176-2e03356c6c3e',
financialAccountId: '2588eeb2-07bf-45cc-aebc-df3776dbf5ed',
financialAccountName: 'y',
financialAccountClass: 'revenue',
financialAccountType: 'revenue',
price: '95448.05'
},
{
organisationId: '7b28dcbd-1f0c-4c00-b176-2e03356c6c3e',
financialAccountId: '6f665285-27cf-45e2-a16a-6ab31be6a874',
financialAccountName: 'z',
financialAccountClass: 'revenue',
financialAccountType: 'revenue',
price: '64717.97'
}
13 replies
DTDrizzle Team
Created by xvx on 6/12/2024 in #help
How to dynamically set a row value using data from a JS object? (onConflictDoUpdate)
@Sylvain For financialAccountId yes it's the primaryKey. It isn't for organisationId but I tried removing that from target and it still persists
13 replies
DTDrizzle Team
Created by xvx on 6/12/2024 in #help
How to dynamically set a row value using data from a JS object? (onConflictDoUpdate)
Thanks I implemented it. Trying to fix there is no unique or exclusion constraint matching the ON CONFLICT specification error now
13 replies
DTDrizzle Team
Created by xvx on 6/12/2024 in #help
How to dynamically set a row value using data from a JS object? (onConflictDoUpdate)
Sorry which part of that?
13 replies
DTDrizzle Team
Created by Jonas on 2/29/2024 in #help
ClientAuthentication Error using heroku-postgres
The problem persisted for me when I did: - put sslmode=require at the end of the connection string - put ssl: true in postgres(conn_str, {here}) and defineConfig({..., dbCredentials: {here}) until I replaced in dbCredentials the url object with each individual pg credential (including ssl: true)
10 replies