Skip to content

Commit

Permalink
fix: was unable to create local db
Browse files Browse the repository at this point in the history
  • Loading branch information
LovelessCodes committed Nov 7, 2024
1 parent 94cf953 commit d3b100d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# deps
node_modules/

.env
.env

dev.db
4 changes: 3 additions & 1 deletion drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'dotenv/config';
import { defineConfig } from 'drizzle-kit';

const authToken = process.env.TURSO_DB_AUTH_TOKEN;

export default defineConfig({
out: './drizzle',
schema: './src/db/auth-schema.ts',
dialect: 'turso',
dialect: authToken ? 'turso' : 'sqlite',
dbCredentials: {
url: process.env.TURSO_DB_URL || 'file:dev.db',
authToken: process.env.TURSO_DB_AUTH_TOKEN,
Expand Down
1 change: 1 addition & 0 deletions src/db/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { drizzle } from "drizzle-orm/libsql";
import * as authSchema from "./auth-schema";

// You can specify any property from the libsql connection options
export const db = drizzle({
Expand Down

0 comments on commit d3b100d

Please sign in to comment.