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

SQL Server: @default(now()) didn't work and put null in the database #20884

Closed
janpio opened this issue Aug 29, 2023 · 3 comments
Closed

SQL Server: @default(now()) didn't work and put null in the database #20884

janpio opened this issue Aug 29, 2023 · 3 comments
Assignees
Labels
bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. domain/client Issue in the "Client" domain: Prisma Client, Prisma Studio etc. kind/bug A reported bug. tech/engines/query engine Issue in the Query Engine topic: @default(now()) topic: default topic: sql server Microsoft SQL Server

Comments

@janpio
Copy link
Member

janpio commented Aug 29, 2023

via #12729 from @max-programming;

Problem

In SQL Server with Prisma, when I used @default(now()) it didn't work and put null in the database. More at #12705

Suggested solution

It would be good if the default function in the prisma schema works fine

@janpio janpio added bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. tech/engines/query engine Issue in the Query Engine topic: sql server Microsoft SQL Server domain/client Issue in the "Client" domain: Prisma Client, Prisma Studio etc. topic: default topic: @default(now()) labels Aug 29, 2023
@janpio janpio self-assigned this May 22, 2024
@janpio
Copy link
Member Author

janpio commented May 22, 2024

I can not confirm this, both of these schemas (with and without native typewould successfully generate a date when inserting a row:

model Foo {
  id        Int       @id() @default(autoincrement())
  createdAt DateTime? @default(now()) @db.DateTime
}
model Foo {
  id   Int      @id() @default(autoincrement())
  date DateTime @default(now())
}

image

What am I missing @max-programming?

@janpio janpio added bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. and removed bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. labels May 22, 2024
@max-programming
Copy link

Looks like it works then. Since then I haven't used sql server. That was a rare occassion. Also it's been a long time so this might have been patched by now ✌️

@janpio
Copy link
Member Author

janpio commented May 23, 2024

Ok, closing then. If this happens to anyone else, they will open another bug issue report. Thanks!

@janpio janpio closed this as not planned Won't fix, can't repro, duplicate, stale May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. domain/client Issue in the "Client" domain: Prisma Client, Prisma Studio etc. kind/bug A reported bug. tech/engines/query engine Issue in the Query Engine topic: @default(now()) topic: default topic: sql server Microsoft SQL Server
Projects
None yet
Development

No branches or pull requests

2 participants