Skip to content

Open-source status page, incident response and uptime monitoring

739 B
Raw Blame
import { sql } from "drizzle-orm";
import { index, integer, sqliteTable, text } from "drizzle-orm/sqlite-core";

import { workspace } from "../workspaces";

export const application = sqliteTable(
  "application",
  {
    id: integer("id").primaryKey(),
    name: text("name"), // friendly name for the project
    dsn: text("dsn").unique(), // dsn for the source

    workspaceId: integer("workspace_id").references(() => workspace.id),

    createdAt: integer("created_at", { mode: "timestamp" }).default(
      sql`(strftime('%s', 'now'))`,
    ),
    updatedAt: integer("updated_at", { mode: "timestamp" }).default(
      sql`(strftime('%s', 'now'))`,
    ),
  },
  (t) => [index("application_workspace_id_idx").on(t.workspaceId)],
);