Openstatus
www.openstatus.dev
1import { sql } from "drizzle-orm";
2import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
3import { createInsertSchema } from "drizzle-zod";
4
5import { workspace } from "./workspaces";
6
7export const integration = sqliteTable("integration", {
8 id: integer("id").primaryKey(),
9 name: text("name", { length: 256 }).notNull(), // Should be vercel or other
10
11 workspaceId: integer("workspace_id").references(() => workspace.id),
12
13 // Not used yet but we might need to get store something for the integration webhook url and or secret
14 credential: text("credential", { mode: "json" }),
15
16 externalId: text("external_id").notNull(), // the id of the integration in the external service
17
18 createdAt: integer("created_at", { mode: "timestamp" }).default(
19 sql`(strftime('%s', 'now'))`,
20 ),
21 updatedAt: integer("updated_at", { mode: "timestamp" }).default(
22 sql`(strftime('%s', 'now'))`,
23 ),
24
25 data: text("data", { mode: "json" }).notNull(),
26});
27
28export const insertIntegrationSchema = createInsertSchema(integration);