Skip to content

Commit

Permalink
consistent timestamp data types
Browse files Browse the repository at this point in the history
  • Loading branch information
dromzeh committed Oct 19, 2023
1 parent 63e0a93 commit c5f5cd1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"typecheck": "tsc --noEmit",
"drizzle:generate": "drizzle-kit generate:sqlite",
"drizzle:migrate": "ts-node ./src/scripts/migrate/migrate",
"drizzle:push": "drizzle-kit push:sqlite"
"drizzle:push": "drizzle-kit push:sqlite",
"drizzle:studio": "drizzle-kit studio"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20231016.0",
Expand Down
4 changes: 2 additions & 2 deletions src/v2/db/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ export const userCollection = sqliteTable(
onUpdate: "cascade",
onDelete: "cascade",
}),
dateCreated: integer("date_created").notNull(),
dateCreated: text("date_created").notNull(),
isPublic: integer("is_public").default(0).notNull(),
},
(collection) => {
Expand Down Expand Up @@ -458,7 +458,7 @@ export const savedOcGenerators = sqliteTable(
}),
name: text("name").notNull(),
game: text("game").notNull(),
dateCreated: integer("date_created").notNull(),
dateCreated: text("date_created").notNull(),
isPublic: integer("is_public").default(0).notNull(),
content: text("content").notNull(),
savedColorPalette: text("saved_color_palette"), // array of 5 hex values, completely optional for the user to save
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export async function createAssetCollection(c: APIContext): Promise<Response> {
name: collection.name,
description: collection.description,
userId: session.user.userId,
dateCreated: new Date().getTime(),
dateCreated: new Date().toISOString(),
isPublic: 0, // default to private
})
.execute()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export async function saveOCGeneratorResponse(
userId: session.user.userId,
name: formData.data.name,
game: formData.data.game,
dateCreated: new Date().getTime(),
dateCreated: new Date().toISOString(),
isPublic: parseInt(formData.data.isPublic), // 1 = yes, 0 = no, default = 0
content: formData.data.content, // this is stored as json, which can then be parsed
}
Expand Down

0 comments on commit c5f5cd1

Please sign in to comment.