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]: error: column is of type integer[] but default expression is of type integer #2224

Open
hamidreza4dev opened this issue Apr 28, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@hamidreza4dev
Copy link

What version of drizzle-orm are you using?

0.30.8

What version of drizzle-kit are you using?

0.20.17

Describe the Bug

error: column "roles" is of type integer[] but default expression is of type integer

schema:

export const users = pgTable('users', {
  id: serial('id').primaryKey(),
  fullname: text('fullname').notNull(),
  roles: integer('roles').array().default([1]).notNull(),
});

Expected behavior

set [1] as default value for roles column

Environment & setup

No response

@hamidreza4dev hamidreza4dev added the bug Something isn't working label Apr 28, 2024
@kangkangovo2333
Copy link

if you use variables:
.default(sql.raw(ARRAY[${variables}]::integer[]))
else:
.default(sqlARRAY[1]::integer[])

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