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?
Thanks for the detailed feedback @onderay ! Very helpful to have a second opinion on this 🙇‍♂️
3 replies
DTDrizzle Team
Created by Woet on 5/12/2024 in #help
Running schema migrations on the server
Perhaps there's a way for me to do this with drizzle-kit push:pg --schema ./src/db/global/schema.ts --driver pg --connectionString $DATABASE_URL ?
3 replies
DTDrizzle Team
Created by Woet on 5/12/2024 in #help
Running schema migrations on the server
It would also work if I could somehow get the SQL output of the entire creation of my schema that would come from drizzle-kit generate:pg if no other migrations exist yet and then run that SQL code after the database creation.
3 replies
DTDrizzle Team
Created by Woet on 5/10/2024 in #help
Postgres - Unique constraint that allows null
Thanks for getting back to me on this @Mykhailo , I already found a way to fix the issue I was having. Already a couple of days ago, so I don't exactly remember what the solution was anymore, but seems to work now 🙂
5 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
makes sense, thanks!
11 replies
TTCTheo's Typesafe Cult
Created by Woet on 4/21/2024 in #questions
Run migration with Drizzle for Neon
first time building some with the t3-stack, was expecting it to already take care of the need to import "dotenv/config";
11 replies
TTCTheo's Typesafe Cult
Created by Woet on 4/21/2024 in #questions
Run migration with Drizzle for Neon
thanks @barry ! that idd did the trick
11 replies
TTCTheo's Typesafe Cult
Created by Woet on 4/21/2024 in #questions
Run migration with Drizzle for Neon
They get picked up at runtime, but just not in this script
11 replies
TTCTheo's Typesafe Cult
Created by Woet on 4/21/2024 in #questions
Run migration with Drizzle for Neon
But for some reason they're not picked up when running the scripts
11 replies
TTCTheo's Typesafe Cult
Created by Woet on 4/21/2024 in #questions
Run migration with Drizzle for Neon
Hmm all these variables are defined in my .env file though
11 replies
TTCTheo's Typesafe Cult
Created by Woet on 4/21/2024 in #questions
Run migration with Drizzle for Neon
This is my migration file:
import { env } from "~/env";
import { drizzle } from "drizzle-orm/neon-http";
import { migrate } from "drizzle-orm/neon-http/migrator";
import { neon } from "@neondatabase/serverless";

const sql: ReturnType<typeof neon> | undefined = neon(env.DATABASE_URL);

const db = drizzle(sql);

const main = async () => {
try {
console.log("DATABASE URL");
console.log(env.DATABASE_URL);
await migrate(db, {
migrationsFolder: "src/db/global/migrations",
});

console.log("Migration complete!");
} catch (error) {
console.error("Migration failed", error);
}
};

await main();
import { env } from "~/env";
import { drizzle } from "drizzle-orm/neon-http";
import { migrate } from "drizzle-orm/neon-http/migrator";
import { neon } from "@neondatabase/serverless";

const sql: ReturnType<typeof neon> | undefined = neon(env.DATABASE_URL);

const db = drizzle(sql);

const main = async () => {
try {
console.log("DATABASE URL");
console.log(env.DATABASE_URL);
await migrate(db, {
migrationsFolder: "src/db/global/migrations",
});

console.log("Migration complete!");
} catch (error) {
console.error("Migration failed", error);
}
};

await main();
11 replies