mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
23 lines
525 B
TypeScript
23 lines
525 B
TypeScript
import { Sequelize } from 'sequelize-typescript';
|
|
import { Cat } from '../cats/cat.entity';
|
|
|
|
export const databaseProviders = [
|
|
{
|
|
provide: 'SEQUELIZE',
|
|
useFactory: async () => {
|
|
const sequelize = new Sequelize({
|
|
operatorsAliases: false,
|
|
dialect: 'mysql',
|
|
host: 'localhost',
|
|
port: 3306,
|
|
username: 'root',
|
|
password: 'root',
|
|
database: 'test',
|
|
});
|
|
sequelize.addModels([Cat]);
|
|
await sequelize.sync();
|
|
return sequelize;
|
|
},
|
|
},
|
|
];
|