Skip to content

Commit

Permalink
Only migrate db once to fix runtime errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Rerbun committed Apr 28, 2024
1 parent c6bc952 commit e7e1a65
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/database-utils.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { drizzle } from 'drizzle-orm/better-sqlite3';
import { migrate } from 'drizzle-orm/better-sqlite3/migrator';
import Database from 'better-sqlite3';
import { eq, desc, inArray } from 'drizzle-orm';
import { pick } from 'lodash-es';
import { pick, once } from 'lodash-es';
import { Todo } from '../interfaces/Todo';
import { todoTable } from '../db/schema.server';

Expand All @@ -12,7 +12,7 @@ const sqlite = new Database(
);
const db = drizzle(sqlite);

migrate(db, { migrationsFolder: 'migrations' });
once(() => migrate(db, { migrationsFolder: 'migrations' }));

export const getTodoById = async (id: string) => {
const todoEntry: Record<string, any> = (
Expand Down

0 comments on commit e7e1a65

Please sign in to comment.