Skip to content

Commit

Permalink
feat: automatically run migrate in DB instead of running in NPM scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ixartz committed Jan 7, 2024
1 parent fb74ba1 commit b202686
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dev:spotlight": "spotlight-sidecar",
"dev:next": "next dev",
"dev": "run-p dev:*",
"build": "npm run db:migrate && next build",
"build": "next build",
"start": "next start",
"build-stats": "cross-env ANALYZE=true npm run build",
"clean": "rimraf .next .swc out coverage",
Expand Down
6 changes: 2 additions & 4 deletions src/libs/DB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ const client = createClient({

export const db = drizzle(client);

// Disable migrate function if using Edge runtime for local environment and use `drizzle-kit push` instead
if (process.env.NODE_ENV !== 'production') {
await migrate(db, { migrationsFolder: './migrations' });
}
// Disable migrate function if using Edge runtime and use `drizzle-kit push` instead
await migrate(db, { migrationsFolder: './migrations' });

Check warning on line 15 in src/libs/DB.ts

View check run for this annotation

Codecov / codecov/patch

src/libs/DB.ts#L15

Added line #L15 was not covered by tests

0 comments on commit b202686

Please sign in to comment.