feat: align with upstream 1.5.9.9
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { db } from '~/drizzle/db'
|
||||
import { scheduleSongPool, songs } from '~/drizzle/schema'
|
||||
import { eq, count } from 'drizzle-orm'
|
||||
|
||||
// 返回备选池有效记录数(innerJoin 排除歌曲已删除的孤立记录)
|
||||
export const fetchPoolCount = async () => {
|
||||
const result = await db
|
||||
.select({ count: count() })
|
||||
.from(scheduleSongPool)
|
||||
.innerJoin(songs, eq(scheduleSongPool.songId, songs.id))
|
||||
.limit(1)
|
||||
return result[0]?.count || 0
|
||||
}
|
||||
Reference in New Issue
Block a user