-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathuser-preferences.ts
More file actions
20 lines (18 loc) · 979 Bytes
/
user-preferences.ts
File metadata and controls
20 lines (18 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { boolean, index, pgTable, primaryKey, timestamp, varchar } from 'drizzle-orm/pg-core';
export const userPreferencesTable = pgTable(
'user_preferences',
{
userId: varchar('user_id', { length: 191 }).notNull(),
organizationId: varchar('organization_id', { length: 191 }).notNull(),
hasCompletedOnboarding: boolean('has_completed_onboarding').notNull().default(false),
hasCompletedBuilderTour: boolean('has_completed_builder_tour').notNull().default(false),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(),
},
(table) => ({
pk: primaryKey({ columns: [table.userId, table.organizationId] }),
orgIdx: index('user_preferences_org_idx').on(table.organizationId),
}),
);
export type UserPreferences = typeof userPreferencesTable.$inferSelect;
export type NewUserPreferences = typeof userPreferencesTable.$inferInsert;