-
Notifications
You must be signed in to change notification settings - Fork 66
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
feat: add createdAt and updatedAt fields to public tables #587
base: master
Are you sure you want to change the base?
Conversation
Also, please tell me if I should update any of the tests |
thanks! this looks cool tests need to pass. Probably possible to wrap things into a function to not have to copy and paste |
What if we do this for createdAt? https://stackoverflow.com/a/30686739 It's not 100% necessary for this function to work on SQLite, so maybe the schema could fallback to just defaulting to 0 for SQLite. There is a comment format you can use to exclude a line in the |
yeah, it is
That'd also be possible. Besides my previously mentioned concerns of desynced time sources, if we're gonna go for storing the timestamp as a string, then I'd really like it to be in ISO 8601 (js: On that note, Falsehoods programmers believe about time is always a good read when working with timestamps 😄 |
3186f2d
to
277ea72
Compare
4a4c050
to
829fd5d
Compare
@ajayyy In the beginning I started work on another pr that would make updating the test queries a bit easier, but I got busy and ended up just updating the single queries 😔 |
Xx590731 |
2 similar comments
Xx590731 |
Xx590731 |
Add a
createdAt
andupdatedAt
field.Both fields would make incremental database updates easier and more efficient.
It would allow mirrors to selectively update small chunks at a time, instead of having to do a full table diff.
This is especially important for me personally, as I want to work on partial updates that don't rely on downloading the whole table.
(though it would still be difficult with deleted rows, since they would still need a full table diff. Soft deletes with a
deletedAt
ordeleted(bool)
+updatedAt field would probably be the best fix)The changes:
updatedAt
field to all public tables where I could find an UPDATE sql query in the code.thumbnailTimestamps
,vipUsers
,videoInfo
,unlistedVideos
,archivedSponsorTimes
,ratings
,thumbnails
createdAt
field to all public tables that don't already have atimeSubmitted
fieldNotes:
While it is nice that all necessary tables have the fields, I would like to add them to all tables. And yes, even the private db.
timeSubmitted
was implemented.timestamp
type andcurrent_timestamp
default value, but this would make it hard to switch to a different db if necessary.timeSubmitted
andupdatedAt
have a different source, making it possible for e.g. the createdAt timestamp from the pg server to be younger thantimeSubmitted
from the node server.