This commit is contained in:
@@ -214,15 +214,25 @@ export const channelLinks = pgTable(
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
/** 'slack' | 'buzz' — kept as text so a new platform needs no migration. */
|
||||
platform: text('platform').notNull(),
|
||||
/** Slack channel ids are unique only inside a workspace. Buzz uses ''. */
|
||||
workspaceId: text('workspace_id').notNull().default(''),
|
||||
channelId: text('channel_id').notNull(),
|
||||
channelName: text('channel_name'),
|
||||
accountId: uuid('account_id').references(() => accounts.id, { onDelete: 'cascade' }),
|
||||
/** Notify on stage changes, idle-capacity alerts, renewals due. */
|
||||
notifyOn: jsonb('notify_on').$type<string[]>().notNull().default([]),
|
||||
linkedByUserId: uuid('linked_by_user_id').references(() => users.id, {
|
||||
onDelete: 'set null',
|
||||
}),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
||||
updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),
|
||||
},
|
||||
(t) => [
|
||||
uniqueIndex('channel_links_platform_channel_key').on(t.platform, t.channelId),
|
||||
uniqueIndex('channel_links_platform_workspace_channel_key').on(
|
||||
t.platform,
|
||||
t.workspaceId,
|
||||
t.channelId,
|
||||
),
|
||||
index('channel_links_account_idx').on(t.accountId),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user