Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dromzeh committed Mar 29, 2024
1 parent 6bed840 commit 54c4f8b
Showing 1 changed file with 48 additions and 48 deletions.
96 changes: 48 additions & 48 deletions src/v2/db/schema/tags/asset-tags-likes.ts
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
import { tableNames } from "@/v2/db/drizzle"
import { relations } from "drizzle-orm"
import { index, sqliteTable, text } from "drizzle-orm/sqlite-core"
import { authUser } from "../user/user"
import { assetTag } from "./asset-tags"
import { createInsertSchema, createSelectSchema } from "drizzle-zod"
export const assetTagLikes = sqliteTable(
tableNames.assetTagLikes,
{
assetTagId: text("asset_id")
.notNull()
.references(() => assetTag.id),
likedById: text("liked_by_id")
.notNull()
.references(() => authUser.id),
createdAt: text("created_at")
.notNull()
.$defaultFn(() => {
return new Date().toISOString()
}),
},
(gameLikes) => {
return {
assetTagIdx: index("assetTagLikes_asset_idx").on(
gameLikes.assetTagId
),
likedByIdx: index("assetTagLikes_likedby_idx").on(
gameLikes.likedById
),
}
}
)
// import { tableNames } from "@/v2/db/drizzle"
// import { relations } from "drizzle-orm"
// import { index, sqliteTable, text } from "drizzle-orm/sqlite-core"
// import { authUser } from "../user/user"
// import { assetTag } from "./asset-tags"
// import { createInsertSchema, createSelectSchema } from "drizzle-zod"
// export const assetTagLikes = sqliteTable(
// tableNames.assetTagLikes,
// {
// assetTagId: text("asset_id")
// .notNull()
// .references(() => assetTag.id),
// likedById: text("liked_by_id")
// .notNull()
// .references(() => authUser.id),
// createdAt: text("created_at")
// .notNull()
// .$defaultFn(() => {
// return new Date().toISOString()
// }),
// },
// (gameLikes) => {
// return {
// assetTagIdx: index("assetTagLikes_asset_idx").on(
// gameLikes.assetTagId
// ),
// likedByIdx: index("assetTagLikes_likedby_idx").on(
// gameLikes.likedById
// ),
// }
// }
// )

export type AssetTagLikes = typeof assetTagLikes.$inferSelect
export type NewAssetTagLikes = typeof assetTagLikes.$inferInsert
export const insertAssetTagLikesSchema = createInsertSchema(assetTagLikes)
export const selectAssetTagLikesSchema = createSelectSchema(assetTagLikes)
// export type AssetTagLikes = typeof assetTagLikes.$inferSelect
// export type NewAssetTagLikes = typeof assetTagLikes.$inferInsert
// export const insertAssetTagLikesSchema = createInsertSchema(assetTagLikes)
// export const selectAssetTagLikesSchema = createSelectSchema(assetTagLikes)

export const assetTagLikesRelations = relations(assetTagLikes, ({ one }) => ({
assetTag: one(assetTag, {
fields: [assetTagLikes.assetTagId],
references: [assetTag.id],
relationName: "assetTagLikes_liked_assetTag",
}),
likedBy: one(authUser, {
fields: [assetTagLikes.likedById],
references: [authUser.id],
relationName: "assetTagLikes_liked_by",
}),
}))
// export const assetTagLikesRelations = relations(assetTagLikes, ({ one }) => ({
// assetTag: one(assetTag, {
// fields: [assetTagLikes.assetTagId],
// references: [assetTag.id],
// relationName: "assetTagLikes_liked_assetTag",
// }),
// likedBy: one(authUser, {
// fields: [assetTagLikes.likedById],
// references: [authUser.id],
// relationName: "assetTagLikes_liked_by",
// }),
// }))

0 comments on commit 54c4f8b

Please sign in to comment.