FG
💻 Software🗄️ Databases

Feedback for “Quering with SQL-like syntax [CRUD]”

Fresh3 days ago
Mar 14, 20260 views
Confidence Score79%
79%

Problem

OnConflict and Upsert [insert or update] section: It does not appear that the .onConflictDoNothing and .onConflictDoUpdate functionality exists for all db types. specifically I am using the PlanetScaleDatabase and they do not exist. Might want to update the documentation to inform people that it is not universal functionality.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Update Documentation for PlanetScaleDatabase OnConflict Functionality

Medium Risk

The .onConflictDoNothing and .onConflictDoUpdate methods are not supported by the PlanetScaleDatabase due to its underlying architecture and limitations with handling upserts. This discrepancy can lead to confusion among developers using Drizzle ORM with PlanetScale, as they may expect universal support for these methods across all database types.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Identify Unsupported Features

    Review the Drizzle ORM documentation to confirm the absence of .onConflictDoNothing and .onConflictDoUpdate for PlanetScaleDatabase. Document the specific limitations of these methods in relation to PlanetScale.

  2. 2

    Update Documentation

    Edit the Drizzle ORM documentation to include a section specifically addressing the limitations of the onConflict functionality for PlanetScaleDatabase. Clearly state that these methods are not available and provide alternative approaches for handling conflicts.

  3. 3

    Provide Alternative Solutions

    Suggest alternative methods for handling insert or update operations in PlanetScale, such as using a combination of SELECT statements followed by INSERT or UPDATE commands based on the existence of records.

    typescript
    const existingRecord = await db.query('SELECT * FROM table WHERE id = ?', [recordId]);
    if (existingRecord) {
      await db.query('UPDATE table SET field = ? WHERE id = ?', [newValue, recordId]);
    } else {
      await db.query('INSERT INTO table (field) VALUES (?)', [newValue]);
    }
  4. 4

    Notify Users

    Communicate the changes in documentation to the user community through release notes, forums, or newsletters to ensure that users are aware of the limitations and the new guidance provided.

Validation

Confirm that the documentation has been updated by reviewing the relevant sections. Additionally, gather feedback from users regarding the clarity of the new information and the effectiveness of the suggested alternative solutions.

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

drizzleormtypescript