Drizzle TeamDT
Drizzle Team2y ago
4 replies
zerokelvin

Drizzle incorrectly building query with DEFAULT instead of $11 in insertion

Drizzle ORM built this query:
INSERT INTO "domains" (
    "name", 
    "formatted_name", 
    "root_name", 
    "tld", 
    "godaddy_auction_id", 
    "price", 
    "bid_count", 
    "auction_end_time", 
    "majestic_trust_flow", 
    "majestic_citation_flow", 
    "majestic_backlink_count", 
    "majestic_referring_domain_count"
) VALUES 
    ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, DEFAULT, DEFAULT), 
    ($11, $12, $13, $14, $15, $16, $17, $18, $19, $20, DEFAULT, DEFAULT), 
    ($21, $22, $23, $24, $25, $26, $27, $28, $29, $30, DEFAULT, DEFAULT), 
    ($31, $32, $33, $34, $35, $36, $37, $38, $39, $40, DEFAULT, DEFAULT), 
    ($41, $42, $43, $44, $45, $46, $47, $48, $49, $50, DEFAULT, DEFAULT)
ON CONFLICT ("name") DO UPDATE 
    SET "majestic_backlink_count" = excluded.majestic_backlink_count;


Here's the query:
    const rez = await db
      .insert(domains)
      .values(values)
      .onConflictDoUpdate({
        target: domains.name,
        set: buildConflictUpdateColumns(domains, [
          "auctionPrice",
          "bidCount",
          "auctionEndTime",
          "majesticTrustFlow",
          "majesticCitationFlow",
          "majesticBacklinkCount",
          "majesticReferringDomainCount",
        ]),
      })


Why do majestic_backlink_count and majestic_referring_domain_count not have values like $11? This is resulting in data being set to NULL instead of the number value I've specified. How do I fix this?
Was this page helpful?