Woet
Woet
Explore posts from servers
KKinde
Created by Woet on 5/30/2024 in #💻┃support
Next.js app router: is it safe to do the authenticated check in the layout?
No description
3 replies
DTDrizzle Team
Created by Woet on 5/12/2024 in #help
Running schema migrations on the server
I'm currently in need to run schema migrations directly on the server instead of the CLI. I'd need this because I'm programmatically provisioning a database on Neon with their API and I'd like to run the initial schema migration directly from my code on the server on that newly created database. I found a couple months old question on this, without any other responses: https://github.com/drizzle-team/drizzle-orm/discussions/1901 Is there any way to make this possible without directly running SQL?
3 replies
DTDrizzle Team
Created by Woet on 5/10/2024 in #help
Postgres - Unique constraint that allows null
No description
5 replies
TTCTheo's Typesafe Cult
Created by Woet on 4/21/2024 in #questions
Run migration with Drizzle for Neon
Sorry if this is a n00b question, but I'm having some troubles running a migration of a Neon database locally with the env.js. I'm trying to run this with the command pnpm run db:migrate in the terminal This is the script in package.json: "db:migrate": "tsx ./src/server/db/global/migrate.ts" This gives me an error about the environment variables, anyone have an idea what I could do to fix this? : I only need the DATABASE_URL in this migration and this is defined so I'm not sure why I'm getting an error on this.
> tsx ./src/server/db/global/migrate.ts

❌ Invalid environment variables: {
DATABASE_URL: [ 'Required' ],
NEXT_PUBLIC_POSTHOG_HOST: [ 'Required' ],
NEXT_PUBLIC_POSTHOG_KEY: [ 'Required' ]
}
file:///home/woet/prioflux/finisync/node_modules/.pnpm/@t3-oss+env-core@0.9.2_typescript@5.4.5_zod@3.22.5/node_modules/@t3-oss/env-core/dist/index.js:29
throw new Error("Invalid environment variables");
^

Error: Invalid environment variables
at onValidationError (file:///home/woet/prioflux/finisync/node_modules/.pnpm/@t3-oss+env-core@0.9.2_typescript@5.4.5_zod@3.22.5/node_modules/@t3-oss/env-core/dist/index.js:29:15)
at createEnv (file:///home/woet/prioflux/finisync/node_modules/.pnpm/@t3-oss+env-core@0.9.2_typescript@5.4.5_zod@3.22.5/node_modules/@t3-oss/env-core/dist/index.js:35:16)
at createEnv (file:///home/woet/prioflux/finisync/node_modules/.pnpm/@t3-oss+env-nextjs@0.9.2_typescript@5.4.5_zod@3.22.5/node_modules/@t3-oss/env-nextjs/dist/index.js:12:12)
at file:///home/woet/prioflux/finisync/src/env.js:4:20
at ModuleJob.run (node:internal/modules/esm/module_job:192:25)
at async CustomizedModuleLoader.import (node:internal/modules/esm/loader:228:24)
at async loadESM (node:internal/process/esm_loader:40:7)
at async handleMainPromise (node:internal/modules/run_main:66:12)

Node.js v20.5.1
 ELIFECYCLE  Command failed with exit code 1.
> tsx ./src/server/db/global/migrate.ts

❌ Invalid environment variables: {
DATABASE_URL: [ 'Required' ],
NEXT_PUBLIC_POSTHOG_HOST: [ 'Required' ],
NEXT_PUBLIC_POSTHOG_KEY: [ 'Required' ]
}
file:///home/woet/prioflux/finisync/node_modules/.pnpm/@t3-oss+env-core@0.9.2_typescript@5.4.5_zod@3.22.5/node_modules/@t3-oss/env-core/dist/index.js:29
throw new Error("Invalid environment variables");
^

Error: Invalid environment variables
at onValidationError (file:///home/woet/prioflux/finisync/node_modules/.pnpm/@t3-oss+env-core@0.9.2_typescript@5.4.5_zod@3.22.5/node_modules/@t3-oss/env-core/dist/index.js:29:15)
at createEnv (file:///home/woet/prioflux/finisync/node_modules/.pnpm/@t3-oss+env-core@0.9.2_typescript@5.4.5_zod@3.22.5/node_modules/@t3-oss/env-core/dist/index.js:35:16)
at createEnv (file:///home/woet/prioflux/finisync/node_modules/.pnpm/@t3-oss+env-nextjs@0.9.2_typescript@5.4.5_zod@3.22.5/node_modules/@t3-oss/env-nextjs/dist/index.js:12:12)
at file:///home/woet/prioflux/finisync/src/env.js:4:20
at ModuleJob.run (node:internal/modules/esm/module_job:192:25)
at async CustomizedModuleLoader.import (node:internal/modules/esm/loader:228:24)
at async loadESM (node:internal/process/esm_loader:40:7)
at async handleMainPromise (node:internal/modules/run_main:66:12)

Node.js v20.5.1
 ELIFECYCLE  Command failed with exit code 1.
11 replies