2019-02-07 23:21:23 +08:00
|
|
|
import {Config} from '../../../../common/config/private/Config';
|
2019-12-10 16:36:14 +08:00
|
|
|
import {ServerConfig} from '../../../../common/config/private/IPrivateConfig';
|
2019-02-07 23:21:23 +08:00
|
|
|
import {ColumnOptions} from 'typeorm/decorator/options/ColumnOptions';
|
|
|
|
|
|
|
|
export class ColumnCharsetCS implements ColumnOptions {
|
|
|
|
|
|
|
|
public get charset(): string {
|
2019-12-10 16:36:14 +08:00
|
|
|
return Config.Server.Database.type === ServerConfig.DatabaseType.mysql ? 'utf8' : null;
|
2019-02-07 23:21:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public get collation(): string {
|
2019-12-10 16:36:14 +08:00
|
|
|
return Config.Server.Database.type === ServerConfig.DatabaseType.mysql ? 'utf8_bin' : null;
|
2019-02-07 23:21:23 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export const columnCharsetCS = new ColumnCharsetCS();
|