Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Ombuweb opened this issue Feb 27, 2025 · 1 comment
Closed

Comments

@Ombuweb
Copy link

Ombuweb commented Feb 27, 2025

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);
@atinux
Copy link
Contributor

atinux commented Mar 1, 2025

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

@atinux atinux closed this as not planned Won't fix, can't repro, duplicate, stale Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants