i'm trying to migrate my databse

import { drizzle } from "drizzle-orm/mysql2";
import mysql from "mysql2/promise";
import "dotenv/config";
import * as schema from "./schema";


export default class dbClass {
private static pool = mysql.createPool({
host: "127.0.0.1",
user: "root",
database: "saturn-test",
});

static db = drizzle(dbClass.pool, { schema, mode: 'default' });
};
import { drizzle } from "drizzle-orm/mysql2";
import mysql from "mysql2/promise";
import "dotenv/config";
import * as schema from "./schema";


export default class dbClass {
private static pool = mysql.createPool({
host: "127.0.0.1",
user: "root",
database: "saturn-test",
});

static db = drizzle(dbClass.pool, { schema, mode: 'default' });
};
my code and schema is soemthing like
import { int, text, mysqlSchema } from "drizzle-orm/mysql-core";

export const schema = mysqlSchema("saturn");

export const user = schema.table("users", {
id: int("id").primaryKey().autoincrement(),
username: text("username"),
password: text("password"),
perm: int("perm"),
});
import { int, text, mysqlSchema } from "drizzle-orm/mysql-core";

export const schema = mysqlSchema("saturn");

export const user = schema.table("users", {
id: int("id").primaryKey().autoincrement(),
username: text("username"),
password: text("password"),
perm: int("perm"),
});
4 Replies
aaliyah ^-^
aaliyah ^-^OP7mo ago
I tried to run
pnpm drizzle-kit generate --dialect="mysql" --schema=./src/utils/schema.ts
pnpm drizzle-kit generate --dialect="mysql" --schema=./src/utils/schema.ts
@! dotarjun
Arjun
Arjun7mo ago
??
aaliyah ^-^
aaliyah ^-^OP7mo ago
csn u help @S. Reka can you help me
Sword Molester
Sword Molester7mo ago
What's the error you're getting? Can't help if I don't know what's breaking to begin with
Want results from more Discord servers?
Add your server