Skip to content

[BUG]: Drizzle-Kit Push errors with generation expression is not immutable #4953

@MauriceArikoglu

Description

@MauriceArikoglu

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.44.4

What version of drizzle-kit are you using?

0.31.4

Other packages

No response

Describe the Bug

Attempting to drizzle-kit push a generated columns fails with error: generation expression is not immutable

export const userDevice = app.table('user_device', {
  id: uuid('id').defaultRandom().primaryKey(),
  mode: varchar('device_mode')
    .notNull()
  userId: varchar('user_id')
    .notNull()
    .references(() => users.id, { onDelete: 'cascade' }),
  userIdDeviceMode: varchar('user_id_device_mode4').generatedAlwaysAs(
    () => sql`${userDevice.userId} || ${userDevice.mode}`
  ),
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions