Eco 🌤
Eco 🌤
DTDrizzle Team
Created by Eco 🌤 on 10/14/2024 in #help
How to automatically run migration on NextJS start
I was able to make it work using instrumentation.ts instrumentation.ts
export async function register() {
if (process.env.NEXT_RUNTIME === "nodejs") {
await import("./sentry.server.config");
await import("./server/db/migrate");
await import("./server/db/seed");
}

if (process.env.NEXT_RUNTIME === "edge") {
await import("./sentry.edge.config");
}
}
export async function register() {
if (process.env.NEXT_RUNTIME === "nodejs") {
await import("./sentry.server.config");
await import("./server/db/migrate");
await import("./server/db/seed");
}

if (process.env.NEXT_RUNTIME === "edge") {
await import("./sentry.edge.config");
}
}
migrate.ts
import path from "path";
import { migrate } from "drizzle-orm/mysql2/migrator";
import { db } from "./";

async function run() {
console.log("Running migrations...");
await migrate(db, {
migrationsFolder: path.join(process.cwd(), "server/db/migrations"),
});
console.log("Migrations done!");
}

run().catch((error) => {
console.error(error, "MIGRATION_FAILED");
process.exit(1);
});
import path from "path";
import { migrate } from "drizzle-orm/mysql2/migrator";
import { db } from "./";

async function run() {
console.log("Running migrations...");
await migrate(db, {
migrationsFolder: path.join(process.cwd(), "server/db/migrations"),
});
console.log("Migrations done!");
}

run().catch((error) => {
console.error(error, "MIGRATION_FAILED");
process.exit(1);
});
5 replies
DTDrizzle Team
Created by Eco 🌤 on 10/14/2024 in #help
How to automatically run migration on NextJS start
instructions is not clear.
5 replies
DTDrizzle Team
Created by Eco 🌤 on 10/14/2024 in #help
How to automatically run migration on NextJS start
No description
5 replies
DTDrizzle Team
Created by Eco 🌤 on 10/14/2024 in #help
How to automatically run migration on NextJS start
No description
5 replies
DTDrizzle Team
Created by Eco 🌤 on 5/26/2024 in #help
How to properly infer type or add typings of a returned model with relationship in a component props
I have tried that and it only works if no eager loaded relationship is returned on the query.
with: {
items: {
with: {
product: true,
},
},
},
with: {
items: {
with: {
product: true,
},
},
},
6 replies
DTDrizzle Team
Created by Eco 🌤 on 5/26/2024 in #help
How to properly infer type or add typings of a returned model with relationship in a component props
I do have that and currently I'm just using getCart also on CartSummary since it can be cached. but I wanna know how to add typings on a prop way.
6 replies