Skip to content

Commit

Permalink
feat: remove MIGRATE_DB which not needed anymore with process.env.NOD…
Browse files Browse the repository at this point in the history
…E_ENV
  • Loading branch information
ixartz committed Aug 27, 2023
1 parent 13c3c45 commit 3fe81ae
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/CI.yml
Expand Up @@ -16,9 +16,6 @@ jobs:
name: Build with ${{ matrix.node-version }}
runs-on: ubuntu-latest

env:
MIGRATE_DB: true

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/DB.ts
Expand Up @@ -11,6 +11,6 @@ const client = createClient({

export const db = drizzle(client);

if (Env.NODE_ENV !== 'production' || Env.MIGRATE_DB) {
if (process.env.NODE_ENV !== 'production') {
await migrate(db, { migrationsFolder: './migrations' });
}
7 changes: 1 addition & 6 deletions src/libs/Env.mjs
Expand Up @@ -3,15 +3,12 @@ import { createEnv } from '@t3-oss/env-nextjs';
import process from 'process';
import { z } from 'zod';

// Don't add NODE_ENV into T3 Env, it changes the tree-shaking behavior
export const Env = createEnv({
shared: {
NODE_ENV: z.enum(['development', 'test', 'production']),
},
server: {
CLERK_SECRET_KEY: z.string().nonempty(),
DATABASE_URL: z.string().nonempty(),
DATABASE_AUTH_TOKEN: z.string().optional(),
MIGRATE_DB: z.coerce.boolean().optional(),
},
client: {
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: z.string().nonempty(),
Expand All @@ -21,10 +18,8 @@ export const Env = createEnv({
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL: z.string().nonempty(),
},
runtimeEnv: {
NODE_ENV: process.env.NODE_ENV,
DATABASE_URL: process.env.DATABASE_URL,
DATABASE_AUTH_TOKEN: process.env.DATABASE_AUTH_TOKEN,
MIGRATE_DB: process.env.MIGRATE_DB,
CLERK_SECRET_KEY: process.env.CLERK_SECRET_KEY,
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY:
process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY,
Expand Down

0 comments on commit 3fe81ae

Please sign in to comment.