update:配置替换为MySQL数据库,修复了文章排序字段设置错误。

This commit is contained in:
2023-12-15 15:56:54 +08:00
parent 5bcb4853e5
commit 431246bc23
4 changed files with 92 additions and 156 deletions
+10 -12
View File
@@ -1,5 +1,3 @@
import { resolve } from 'path';
import { TypeOrmModuleOptions } from '@nestjs/typeorm';
/**
@@ -7,17 +5,17 @@ import { TypeOrmModuleOptions } from '@nestjs/typeorm';
*/
export const database = (): TypeOrmModuleOptions => ({
// 以下为mysql配置
// charset: 'utf8mb4',
// logging: ['error'],
// type: 'mysql',
// host: '127.0.0.1',
// port: 3306,
// username: 'root',
// password: '123456789',
// database: 'ink_apps',
charset: 'utf8mb4',
logging: ['error'],
type: 'mysql',
host: '127.0.0.1',
port: 3306,
username: 'root',
password: '12345678910',
database: 'ink_apps',
// 以下为sqlite配置
type: 'better-sqlite3',
database: resolve(__dirname, '../../back/database9.db'),
// type: 'better-sqlite3',
// database: resolve(__dirname, '../../back/database9.db'),
synchronize: true,
autoLoadEntities: true,
});
+1 -1
View File
@@ -207,7 +207,7 @@ export class PostService {
.orderBy('post.createdAt', 'DESC')
.addOrderBy('post.updatedAt', 'DESC')
.addOrderBy('post.publishedAt', 'DESC')
.addOrderBy('post.commentCount', 'DESC');
.addOrderBy('commentCount', 'DESC');
}
}