-
Notifications
You must be signed in to change notification settings - Fork 2
Purge transactions #232
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
Purge transactions #232
Changes from all commits
fc412f6
e658ff7
79dbb9a
3374235
26f7762
ef383c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| /* | ||
| SQLite does not have native time types. The SQL interface allows arbitrary type names including "DATE" and "DATETIME", | ||
| but this is invalid in this API, and results in "NUMERIC" affinity instead of "INTEGER" affinity, | ||
| which is the one we want here | ||
| */ | ||
| export async function up(db) { | ||
| await db.schema.alterTable("transaction").addColumn("createdAt", "integer").execute() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this not be some timestamp column?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SQLite doesn't have a timestamp type, so what I'm doing is saving the timestamp in a numeric format. https://www.sqlite.org/datatype3.html
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the more i use sqlite the more my lovehate relationship with it grows 😄 I guess i would still be inclined to use a date or datetime https://www.sqlite.org/datatype3.html#affinity_name_examples here in the migration, then if we use something other than sqlite it'll still make sense 🤔 maybe this will strictly always be sqlite though 🤷 just sharing thoughts, don't have to change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I use the datetime type, I get this error: invalid column data type "DATETIME"
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is probably the explanation: https://stackoverflow.com/questions/17227110/how-do-datetime-values-work-in-sqlite
So there's probably something here that validates that the type is one of the "standard" types. In any case, Let's add a comment here though to explain this. Somethiing like "SQLite does not have native time types. The SQL interface allows arbitrary type names including "DATE" and "DATETIME", but this is invalid in this API, and results in "NUMERIC" affinity instead of "INTEGER" affinity, which is the one we want here." |
||
|
|
||
| await db.schema.alterTable("transaction").addColumn("updatedAt", "integer").execute() | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we enable setting this to 0 to disable purging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good idea. I just implemented it