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]: #2256

Open
webdevcody opened this issue May 4, 2024 · 1 comment
Open

[BUG]: #2256

webdevcody opened this issue May 4, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@webdevcody
Copy link

What version of drizzle-orm are you using?

0.30.9

What version of drizzle-kit are you using?

0.20.17

Describe the Bug

My config

import { env } from "@/env";
import { defineConfig } from "drizzle-kit";

export default defineConfig({
  schema: "./src/db/schema.ts",
  driver: "turso",
  out: "./drizzle",
  dbCredentials: {
    url: env.DATABASE_URL,
    authToken: env.DATABASE_AUTH_TOKEN,
  },
  verbose: true,
  strict: true,
});

I had this schema:

export const groups = sqliteTable("group", {
  id: text("id")
    .primaryKey()
    .$defaultFn(() => randomUUID()),
  name: text("name").notNull(),
  description: text("description").notNull(),
});

generated and migrated fine

then I added this column

  userId: text("userId")
    .notNull()
    .references(() => users.id, { onDelete: "cascade" }),

which generated this migration

ALTER TABLE group ADD `userId` text NOT NULL REFERENCES user(id);

this script is invalid for sqlite. I had to wrap group with group. Not sure why.

Expected behavior

No response

Environment & setup

No response

@webdevcody webdevcody added the bug Something isn't working label May 4, 2024
@kevinmitch14
Copy link

Could be because "group" is a reserved word?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants