Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️ drizzle #1048

Merged
merged 17 commits into from
Oct 22, 2024
Merged
2 changes: 1 addition & 1 deletion apps/screenshot-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@openstatus/utils": "workspace:^",
"@t3-oss/env-core": "0.7.1",
"@upstash/qstash": "2.6.2",
"drizzle-orm": "0.32.1",
"drizzle-orm": "0.35.3",
"hono": "4.5.3",
"playwright": "1.46.0",
"zod": "3.23.8"
Expand Down
2 changes: 1 addition & 1 deletion apps/web/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
4 changes: 3 additions & 1 deletion apps/web/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ const nextConfig = {
transpilePackages: ["@openstatus/ui", "@openstatus/api"],
experimental: {
serverComponentsExternalPackages: [
"libsql",
// "libsql",
// "@libsql",
"@react-email/components",
"@react-email/render",
"@google-cloud/tasks",
// "@libsql/client",
// "@libsql/hrana-client",
// "better-sqlite3"
],
optimizePackageImports: ["@tremor/react"],
Expand Down
4 changes: 2 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@auth/core": "0.34.1",
"@auth/drizzle-adapter": "1.5.0",
"@auth/drizzle-adapter": "1.7.0",
"@google-cloud/tasks": "5.0.0",
"@headlessui/react": "1.7.17",
"@hookform/resolvers": "3.3.1",
Expand Down Expand Up @@ -61,7 +61,7 @@
"date-fns-tz": "2.0.0",
"lucide-react": "0.279.0",
"nanoid": "5.0.7",
"next": "14.2.4",
"next": "14.2.15",
"next-auth": "5.0.0-beta.21",
"next-contentlayer": "0.3.4",
"next-plausible": "3.12.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@trpc/server": "11.0.0-rc.553",
"nanoid": "5.0.7",
"nanoid-dictionary": "5.0.0-beta.1",
"next": "14.2.4",
"next": "14.2.15",
"random-word-slugs": "0.1.7",
"stripe": "13.8.0",
"superjson": "1.13.3",
Expand Down
3 changes: 1 addition & 2 deletions packages/db/drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export default {
url: env.DATABASE_URL,
authToken: env.DATABASE_AUTH_TOKEN,
},
driver: "turso",
strict: true,
dialect: "sqlite",
dialect: "turso",
} satisfies Config;
8 changes: 4 additions & 4 deletions packages/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"dependencies": {
"@libsql/client": "0.14.0",
"@t3-oss/env-core": "0.7.0",
"drizzle-orm": "0.32.1",
"drizzle-orm": "0.35.3",
"drizzle-zod": "0.5.1",
"zod": "3.23.8"
},
"devDependencies": {
"@openstatus/assertions": "workspace:*",
"@openstatus/tsconfig": "workspace:*",
"@types/node": "20.8.0",
"better-sqlite3": "11.1.2",
"bufferutil": "4.0.7",
"drizzle-kit": "0.23.0",
"better-sqlite3": "11.4.0",
"bufferutil": "4.0.8",
"drizzle-kit": "0.26.1",
"encoding": "0.1.13",
"next-auth": "5.0.0-beta.17",
"typescript": "5.5.2",
Expand Down
14 changes: 7 additions & 7 deletions packages/db/src/db.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { createClient } from "@libsql/client/web";
import { drizzle } from "drizzle-orm/libsql";
import { drizzle } from "drizzle-orm/libsql/http";

import { env } from "../env.mjs";
import * as schema from "./schema";

const client = createClient({
url: env.DATABASE_URL,
authToken: env.DATABASE_AUTH_TOKEN,
export const db = drizzle({
connection: {
url: env.DATABASE_URL,
authToken: env.DATABASE_AUTH_TOKEN,
},
schema,
});

export const db = drizzle(client, { schema });
9 changes: 5 additions & 4 deletions packages/db/src/schema/maintenances/maintenance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,19 @@ export const maintenance = sqliteTable("maintenance", {
export const maintenancesToMonitors = sqliteTable(
"maintenance_to_monitor",
{
monitorId: integer("monitor_id")
.notNull()
.references(() => monitor.id, { onDelete: "cascade" }),
maintenanceId: integer("maintenance_id")
.notNull()
.references(() => maintenance.id, { onDelete: "cascade" }),
monitorId: integer("monitor_id")
.notNull()
.references(() => monitor.id, { onDelete: "cascade" }),

createdAt: integer("created_at", { mode: "timestamp" }).default(
sql`(strftime('%s', 'now'))`,
),
},
(t) => ({
pk: primaryKey({ columns: [t.monitorId, t.maintenanceId] }),
pk: primaryKey({ columns: [t.maintenanceId, t.monitorId] }),
}),
);

Expand Down
2 changes: 1 addition & 1 deletion packages/notifications/discord/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@types/node": "20.8.0",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"next": "14.2.4",
"next": "14.2.15",
"typescript": "5.5.2"
}
}
2 changes: 1 addition & 1 deletion packages/notifications/email/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@types/node": "20.8.0",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"next": "14.2.4",
"next": "14.2.15",
"typescript": "5.5.2"
}
}
2 changes: 1 addition & 1 deletion packages/notifications/slack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@types/node": "20.8.0",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"next": "14.2.4",
"next": "14.2.15",
"typescript": "5.5.2"
}
}
2 changes: 1 addition & 1 deletion packages/notifications/twillio-sms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"@types/validator": "13.12.0",
"next": "14.2.4",
"next": "14.2.15",
"typescript": "5.5.2"
}
}
Loading
Loading