mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-18 00:33:59 +00:00
fix(bots/discord/database): fix schema for role presets
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import type { InferSelectModel } from 'drizzle-orm'
|
import type { InferSelectModel } from 'drizzle-orm'
|
||||||
import { sqliteTable, text } from 'drizzle-orm/sqlite-core'
|
import { integer, sqliteTable, text, uniqueIndex } from 'drizzle-orm/sqlite-core'
|
||||||
|
|
||||||
export const responses = sqliteTable('responses', {
|
export const responses = sqliteTable('responses', {
|
||||||
replyId: text('reply').primaryKey().notNull(),
|
replyId: text('reply').primaryKey().notNull(),
|
||||||
@@ -11,11 +11,18 @@ export const responses = sqliteTable('responses', {
|
|||||||
correctedById: text('by'),
|
correctedById: text('by'),
|
||||||
})
|
})
|
||||||
|
|
||||||
export const appliedPresets = sqliteTable('applied_presets', {
|
export const appliedPresets = sqliteTable(
|
||||||
memberId: text('member').primaryKey().notNull(),
|
'applied_presets',
|
||||||
guildId: text('guild').notNull(),
|
{
|
||||||
presets: text('presets', { mode: 'json' }).$type<string[]>().notNull().default([]),
|
memberId: text('member').notNull(),
|
||||||
})
|
guildId: text('guild').notNull(),
|
||||||
|
preset: text('preset').notNull(),
|
||||||
|
until: integer('until'),
|
||||||
|
},
|
||||||
|
table => ({
|
||||||
|
uniqueComposite: uniqueIndex('unique_composite').on(table.memberId, table.preset, table.guildId),
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
export type Response = InferSelectModel<typeof responses>
|
export type Response = InferSelectModel<typeof responses>
|
||||||
export type AppliedPreset = InferSelectModel<typeof appliedPresets>
|
export type AppliedPreset = InferSelectModel<typeof appliedPresets>
|
||||||
|
|||||||
Reference in New Issue
Block a user