Skip to content
New issue

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

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

Already on GitHub? # to your account

[BUG]: drizzle-kit push:pg not setting default string array in migration #3785

Open
1 task done
raminos opened this issue Dec 17, 2024 · 0 comments
Open
1 task done
Labels
bug Something isn't working db/postgres drizzle/kit priority Will be worked on next

Comments

@raminos
Copy link

raminos commented Dec 17, 2024

Report hasn't been filed before.

  • I have verified that the bug I'm about to report hasn't been filed before.

What version of drizzle-orm are you using?

0.30.10

What version of drizzle-kit are you using?

0.20.18

Other packages

No response

Describe the Bug

Good morning, thanks for this wonderful library! ❤️ I have a little bug report for drizzle-kit.

This morning I wanted to run a DB migration to add the modules field to my organizations table:

export const organizations = authSchema.table(
  "organizations",
  {
    id: uuid("id")
      .default(sql`uuid_generate_v4()`)
      .primaryKey()
      .notNull(),
    name: text("name").notNull(),
    modules: text("modules")
      .array()
      .notNull()
      .default([]),
    createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull(),
    updatedAt: timestamp("updated_at", { mode: "date" }).defaultNow().notNull(),
  });

I ran the following command:

pnpm drizzle-kit push:pg

and got this migration:

ALTER TABLE "auth"."organizations" ADD COLUMN "modules" text[] DEFAULT  NOT NULL;

As you can see the default value is missing. I hope this is helpful 🤗

@raminos raminos added the bug Something isn't working label Dec 17, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working db/postgres drizzle/kit priority Will be worked on next
Projects
None yet
Development

No branches or pull requests

2 participants