Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
1.5 kB ยท 45 lines
TypeScript
12345678910111213141516171819202122232425262728293031323334353637383940414243444546import { relations, sql } from "drizzle-orm";import { integer, sqliteTable, text, unique } from "drizzle-orm/sqlite-core";
import { monitor } from "../monitors";import { notification } from "../notifications";import { page } from "../pages";import { statusReport } from "../status_reports";import { usersToWorkspaces } from "../users";import { workspacePlans } from "./constants";
export const workspace = sqliteTable( "workspace", { id: integer("id").primaryKey(), slug: text("slug").notNull().unique(), // we love random words name: text("name"),
stripeId: text("stripe_id", { length: 256 }).unique(), subscriptionId: text("subscription_id"), plan: text("plan", { enum: workspacePlans }), endsAt: integer("ends_at", { mode: "timestamp" }), paidUntil: integer("paid_until", { mode: "timestamp" }), limits: text("limits").default("{}").notNull(), createdAt: integer("created_at", { mode: "timestamp" }).default( sql`(strftime('%s', 'now'))`, ), updatedAt: integer("updated_at", { mode: "timestamp" }).default( sql`(strftime('%s', 'now'))`, ),
dsn: text("dsn"), // should be removed soon }, (t) => ({ unique: unique().on(t.id, t.dsn), }),);
export const workspaceRelations = relations(workspace, ({ many }) => ({ usersToWorkspaces: many(usersToWorkspaces), pages: many(page), monitors: many(monitor), notifications: many(notification), statusReports: many(statusReport), // TODO: add checks or monitorRuns}));