Barazo AppView backend
barazo.forum
1import { pgTable, serial, text, timestamp, jsonb, index } from 'drizzle-orm/pg-core'
2
3export const behavioralFlags = pgTable(
4 'behavioral_flags',
5 {
6 id: serial('id').primaryKey(),
7 flagType: text('flag_type', {
8 enum: ['burst_voting', 'content_similarity', 'low_diversity'],
9 }).notNull(),
10 affectedDids: jsonb('affected_dids').$type<string[]>().notNull(),
11 details: text('details').notNull(),
12 communityDid: text('community_did'),
13 status: text('status', {
14 enum: ['pending', 'dismissed', 'action_taken'],
15 })
16 .notNull()
17 .default('pending'),
18 detectedAt: timestamp('detected_at', { withTimezone: true }).notNull().defaultNow(),
19 },
20 (table) => [
21 index('behavioral_flags_flag_type_idx').on(table.flagType),
22 index('behavioral_flags_status_idx').on(table.status),
23 index('behavioral_flags_detected_at_idx').on(table.detectedAt),
24 ]
25)