mirror of
https://github.com/shishantbiswas/bknd-examples.git
synced 2026-03-15 18:01:06 +00:00
cleanups/refactor of the entire main branch
All checks were successful
Build and Push to Gitea Registry / build-and-push (push) Successful in 6m40s
All checks were successful
Build and Push to Gitea Registry / build-and-push (push) Successful in 6m40s
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { em, entity, text, boolean, libsql } from "bknd";
|
||||
import { em, entity, text, boolean, libsql, type Connection } from "bknd";
|
||||
|
||||
import type { TanstackStartConfig } from "bknd/adapter/tanstack-start";
|
||||
import { registerLocalMediaAdapter } from "bknd/adapter/node";
|
||||
@@ -19,10 +19,17 @@ declare module "bknd" {
|
||||
interface DB extends Database { }
|
||||
}
|
||||
|
||||
function getDBConnection(): Connection | { url: ":memory:" | (string & {}) } {
|
||||
if (process.env.NODE_ENV !== "production") return { url: ":memory:" };
|
||||
|
||||
return libsql({
|
||||
url: process.env.DATABASE_URL,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
connection: libsql({
|
||||
url: process.env.DATABASE_URL || "http://localhost:8080",
|
||||
}),
|
||||
connection: getDBConnection(),
|
||||
options: {
|
||||
// the seed option is only executed if the database was empty
|
||||
seed: async (ctx) => {
|
||||
|
||||
Reference in New Issue
Block a user