-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
D1 DateTime type does not work #23479
Comments
@brunocascio I'm curious to know what data you have in your database and what's the SQL you executed to create the database schema. Because I could not reproduce this 🤔 See https://d1-tutorial.prisma.workers.dev/ await prisma.example.create({
data: {},
});
const result = await prisma.example.findMany();
console.debug(result); -- CreateTable
CREATE TABLE "Example" (
"id" TEXT NOT NULL PRIMARY KEY,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
|
Thanks @Jolg42 for taking a look into it! Aparrently I had an issue with the way I was seeding the database. So by moving the seed script I've built to an endpoint (for testing purposes) seems to solve the problem. Now is working correctly! Thanks! EDIT: Here's my data before solving the issue 🤦 (datetime was stored as integers rather than datetimes) |
@brunocascio Nice! I want to understand something here, how did you have integers here? I'm curious to know what was the seed script you used for example. |
I was using `Date.now()` in the seed script
El El jue, 14 mar 2024 a la(s) 06:15, Joël Galeran ***@***.***>
escribió:
… @brunocascio <https://github.com/brunocascio> Nice! I want to understand
something here, how did you have integers here?
I'm curious to know what was the seed script you used for example.
—
Reply to this email directly, view it on GitHub
<#23479 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AASJNMYRLMBHQVG5IXZOXUTYYFTEJAVCNFSM6AAAAABEUOKDYCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJWHE4DINRTG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@brunocascio Ok, but what was the code doing? Using the D1 adapter & Or using the D1 database API directly, maybe? |
I was not able to use Sorry, it was like 2 weeks ago and didn't versionate that part so I lost the test script :( So, don't think it was an issue with prisma/adapter itself |
Thanks @brunocascio! I was thinking something along these lines, but I wanted to check with you. |
Bug description
By using
DateTime
field I get the following error when I make a query:In fails both locally and at the edge (cloudflare)
How to reproduce
Expected behavior
Timestamp should be properly parsed as a Date
Prisma information
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: