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

[BUG]: "TypeError: f.UPDATE_RULE.toLowerCase is not a function" #2898

Open
MrJacobSullivan opened this issue Sep 2, 2024 · 0 comments
Open
Labels
bug Something isn't working drizzle/kit drizzle/studio Issues related to Drizzle Studio

Comments

@MrJacobSullivan
Copy link

What version of drizzle-orm are you using?

0.33.0

What version of drizzle-kit are you using?

0.24.2

Describe the Bug

I am using the following:

"@paralleldrive/cuid2": ^2.2.2
"@planetscale/database": ^1.19.0
drizzle-kit: ^0.24.2
drizzle-orm: ^0.33.0

The schema is very simple, only two tables:

import { createId } from "@paralleldrive/cuid2";
import { sql } from "drizzle-orm";
import { mysqlTableCreator, timestamp, varchar } from "drizzle-orm/mysql-core";

const table = mysqlTableCreator((name) => `app_name_${name}`);

export const user = table("user", {
  cuid: varchar("cuid", { length: 128 }).$default(() => createId()),
  createdAt: timestamp("created_at")
    .default(sql`CURRENT_TIMESTAMP`)
    .notNull(),
  updatedAt: timestamp("updated_at").onUpdateNow(),
});

export const userSettings = table("user_settings", {
  cuid: varchar("cuid", { length: 128 }).$default(() => createId()),
  createdAt: timestamp("created_at")
    .default(sql`CURRENT_TIMESTAMP`)
    .notNull(),
  updatedAt: timestamp("updated_at").onUpdateNow(),

  // foreign keys
  userCuid: varchar("user_cuid", { length: 128 }).references(() => user.cuid, {
    onDelete: "cascade",
    onUpdate: "cascade",
  }),
});

When I run drizzle-kit studio, I get the follow after navigating to local.drizzle.studio:

TypeError: f.UPDATE_RULE.toLowerCase is not a function
    at https://local.drizzle.studio/index.js:13913:1267
    at Array.map (<anonymous>)
    at https://local.drizzle.studio/index.js:13913:1115
    at Array.map (<anonymous>)
    at uoi (https://local.drizzle.studio/index.js:13913:233)
    at async hkl (https://local.drizzle.studio/index.js:14122:33572)

Drizzle local storage:

{
  "drizzle-playground": {
    "state": {
      "currentFile": "sql",
      "drizzleValue": null,
      "sqlValue": null,
      "showRecordsAsJson": false,
      "drizzleResult": "{\"json\":null}",
      "sqlResult": "{\"json\":null}"
    },
    "version": 0
  },
  "drizzle-version": "2.0.1",
  "drizzle-global": {
    "state": {
      "showCounts": true,
      "flatSchemas": false
    },
    "version": 0
  },
  "drizzle-custom-theme-ids": []
}

I also filed a bug here: github.com/drizzle-team/drizzle-kit-mirror/issues/555 because I wasn't sure which was the appropriate channel for filing bug reports.

Expected behavior

No response

Environment & setup

MacBook Air M2, 2022
Sonoma 14.6.1

@MrJacobSullivan MrJacobSullivan added the bug Something isn't working label Sep 2, 2024
@L-Mario564 L-Mario564 added drizzle/kit drizzle/studio Issues related to Drizzle Studio labels Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working drizzle/kit drizzle/studio Issues related to Drizzle Studio
Projects
None yet
Development

No branches or pull requests

2 participants