import "reflect-metadata" import { DataSource } from "typeorm" import { User } from "./modules/users/user.entity" import { Role } from "./modules/users/role.entity"; import { CreateUserTables } from "./migrations/001-CreateUserTables"; export const AppDataSource = new DataSource({ type: "mysql", host: "localhost", // 使用IP地址而非localhost port: 3306, username: "root", password: "", // 请替换为实际密码 database: "test", entities: [ User, Role], migrations: [CreateUserTables], synchronize: true, logging: true });