cool-admin-midway icon indicating copy to clipboard operation
cool-admin-midway copied to clipboard

midway的多数据库配置,在cool下完全不支持

Open imagebody opened this issue 2 years ago • 3 comments

经测试。midway的多数据库配置,在cool下完全不支持。

config.orm = {
    default: {
      name: 'default',
      type: 'mysql',
      host: 'rm-xxxxx.mysql.rds.aliyuncs.com',
      port: 3306,
      username: '',
      password: '',
      database: 'account-uat',
      synchronize: false,
      logging: true,
      charset: 'utf8mb4',
      driver: require('mysql2'),
    },
    bear_con: {
      name: 'bear_con',
      type: 'mysql',
      host: 'rm-xxx.mysql.rds.aliyuncs.com',
      port: 3306,
      username: 'dddd',
      password: 'dddd',
      database: 'pe-uat',
      synchronize: false,
      logging: true,
      charset: 'utf8mb4',
      driver: require('mysql2'),
    },
  };


@EntityModel('t_dimensions', { connectionName: 'bear_con' })
export class LibDimensionEntity {
  @PrimaryGeneratedColumn({ type: 'int', name: 'id' })
  id: number;

  @Column('varchar', { name: 'dimension_id', comment: '维度ID', length: 64 })
  dimension_id: string;

}

经测试,@cool-midway/core 里面有bug,完全不支持midway的多数据库配置https://www.midwayjs.org/docs/extensions/orm#%E5%A4%9A%E6%95%B0%E6%8D%AE%E5%BA%93%E6%94%AF%E6%8C%81

这部分源码没有对外开放,我无法修复,还劳请你们修复一下~

@apgzs @GCSLaoLi @cool-team-official

imagebody avatar Mar 23 '22 16:03 imagebody

需要指定 连接名称

cool-team-official avatar Jun 07 '22 02:06 cool-team-official

我也遇到这样的问题,且指定了 connectionName 的 连接名称 但还是不行

vipluosong avatar Sep 05 '22 04:09 vipluosong