DrizzleKit check constraint generation missing value

I added a constraint to this table:
export const purchaseOrderLineItem = createTable(
  "purchase_order_line_item",
  {
    id: varchar("id", { length: 21 }).primaryKey().notNull(),
    length: numeric("length").notNull(),
    width: numeric("width"),
    quantity: integer("quantity").notNull(),
    lineItemCost: numeric("line_item_cost").notNull(),
    purchaseOrderId: varchar("purchase_order_id", { length: 21 })
      .notNull()
      .references(() => purchaseOrder.id),
    productId: text("product_id")
      .notNull()
      .references(() => product.id),
  },
  (table) => {
    return {
      uniqueProductIdLengthWidthForSamePOKey: uniqueIndex(
        "product_id_length_width_purchase_order_id_key",
      ).on(table.productId, table.length, table.width, table.purchaseOrderId),
      quantityMinZero: check("quantity_min_zero", gt(table.quantity, 0)),
    };
  },
);

ALTER TABLE "purchase_order_line_item" ADD CONSTRAINT "quantity_min_zero" CHECK ("purchase_order_line_item"."quantity" > $1);


This generated the following SQL in the migration file. You can see that $1 was returned which should have been a 0, since the minimum is 0. This then leads to failing migrations.

This leads to:
Error during migration: NeonDbError: there is no parameter $1

Is this a known bug?
Was this page helpful?