Closed avallete closed 7 months ago
There is some TODO. Notably we have a chicken-egg problem with dates in sqlite and prisma. Basically: 1. in SQLite, dates are stored as string in ISO format so when you do something like `SELECT CURRENT_TIMESTAMP` The result is something like: `2024-04-10 23:07:53` 1. Prisma will generate a migration for sqlite with a `Datetime` column looking like: `createdAt DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP` BUT while prisma declare this in the database, it work differently: 1. Prisma use it's own convention (numeric timestamp) inside those columns, for all Date fields. 2. Prisma doesn't really rely on the sqlite database default value to generate the dates (otherwise the createdAt would take a string values) So I made change so users using prisma with sqlite and caring about dates can override their models with something like: ``` { createdAt: ({seed}) => new Date((copycat.dateString(seed)).getTime() // will allow to have a numeric value consistent with prisma } ``` What would be great is if we could do that automatically on all "Date" fields if we know the adapter used is prisma. But I couldn't find the right abstraction yet. I think I'll need jgoux and justinvdm on this.
Changes
Fixes S-2040