fix: use ! syntax instead of || ""

This commit is contained in:
Dominik Koch
2024-10-26 12:28:40 +02:00
committed by GitHub
parent e3b20268d5
commit bc91bb3132
22 changed files with 32 additions and 40 deletions

View File

@@ -4,7 +4,7 @@ export default defineConfig({
schema: "./server/db/schema/index.ts",
dialect: "postgresql",
dbCredentials: {
url: process.env.DATABASE_URL || "",
url: process.env.DATABASE_URL!,
},
out: "drizzle",
migrations: {

View File

@@ -7,12 +7,12 @@ declare global {
export let db: PostgresJsDatabase<typeof schema>;
if (process.env.NODE_ENV === "production") {
db = drizzle(postgres(process.env.DATABASE_URL || ""), {
db = drizzle(postgres(process.env.DATABASE_URL!), {
schema,
});
} else {
if (!global.db)
global.db = drizzle(postgres(process.env.DATABASE_URL || ""), {
global.db = drizzle(postgres(process.env.DATABASE_URL!), {
schema,
});

View File

@@ -2,7 +2,7 @@
// import { migrate } from "drizzle-orm/postgres-js/migrator";
// import postgres from "postgres";
// const connectionString = process.env.DATABASE_URL || "";
// const connectionString = process.env.DATABASE_URL!;
// const sql = postgres(connectionString, { max: 1 });
// const db = drizzle(sql);

View File

@@ -3,7 +3,7 @@ import { sql } from "drizzle-orm";
import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";
const connectionString = process.env.DATABASE_URL || "";
const connectionString = process.env.DATABASE_URL!;
const pg = postgres(connectionString, { max: 1 });
const db = drizzle(pg);

View File

@@ -3,7 +3,7 @@
// import postgres from "postgres";
// import { users } from "./schema";
// const connectionString = process.env.DATABASE_URL || "";
// const connectionString = process.env.DATABASE_URL!;
// const pg = postgres(connectionString, { max: 1 });
// const db = drizzle(pg);