aaliyah ^-^
aaliyah ^-^
DTDrizzle Team
Created by aaliyah ^-^ on 6/3/2024 in #help
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"),
});
9 replies