Openstatus www.openstatus.dev
at 4c0f4c00a38753a5d0dfd7e7b7b7706dec6f1503 28 lines 1.0 kB view raw
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);