Skip to content

D1_ERROR: NOT NULL constraint failed: recipes.id: SQLITE_CONSTRAINT #486

Closed as not planned

Description

@Ombuweb

Hi!

dizzleDB.insert produces the
D1_ERROR: NOT NULL constraint failed: recipes.id: SQLITE_CONSTRAINT despite having AUTOINCREMENT.

Below is the schema:

import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';

const columns = {
  id: integer('id').primaryKey({ autoIncrement: true }),
  name: text().notNull(),
  ingredients: text().notNull(),
  steps: text().notNull(),
  image: text().notNull(),
  notes: text().notNull(),
  tags: text(),
  user: text().notNull(),
  // createdAt: datetime({ mode: 'string' }).notNull(),
};
export const recipes = sqliteTable('recipes', columns);

Activity

  1. atinux commented on Mar 1, 2025

    @atinux
    Contributor

    Did you run the migrations? What is inside your server/database/migrations directory?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions