Closed JoaoAlem closed 8 months ago
That's a very good idea. You could make it as:
createdAt: timestamp("created_at", { withTimezone: false, mode: string }).defaultNow().notNull(),
updatedAt: timestamp("updated_at", { withTimezone: false, mode: string }).defaultNow().notNull(),
deletedAt: timestamp("deleted_at", { withTimezone: false, mode: string }),
withTimezone: false
- We have a uniform ISO Date string, and if any timezone related operations are required, we handle then with client-side logic, instead of having to deal with UTC offsets at the server layer.mode: "string"
- In mode: "date"
, queries will return an JavaScript Date()
object instead of the ISO string, which is undesirable since:
Date
assume runtime timezones by default when making date transformations;Thanks, how i don't have anything else to comment in this issue, i'm gonna close it.
Context When writing the routes, i saw that companies schema have a active flag, but the others schemas don't have the flag. And i know that we ain't gonna delete the data in database, so we'll add a flag for everyone.
Solutions To make a standard, we can add active the same flag for every table, but in my opnion, i don't think that is a good idea, because personally i prefer something more verbose. In my opnion, we can change the active flag to a date_delete field and add two more fields: date_create and date_update. This way we can even show to users since when they are members and for each update of the user, we can have last time updated time.