How egg-sequelize connects 2 databases.

"use strict";

module.exports = appInfo => {
  const config = {};

  // should change to your own
  config.keys = appInfo.name + "_sequelize-example";

  config.sequelize = {
    dialect: "mssql", // support: mysql, mariadb, postgres, mssql
    database: "mydb",
    host: "192.168.0.110",
    port: "1433",
    username: "sa",
    password: "123456",
    timezone: "Asia/Shanghai"
  };

  config.cors = {
    allowMethods: "GET,HEAD,PUT,POST,DELETE,PATCH",
    credentials: true
  };
  
  config.static = {
    // dir: path.join(appInfo.baseDir, "app/public"),
    dir: "app/public",
    prefix: "",
    dynamic: true,
    preload: false,
    buffer: false,
    maxFiles: 10000,
  }

// 
  config.security = {
    domainWhiteList: [ 
      "192.168.1.105:8080",
      "192.168.1.100:8080",
    ],
    xframe: {
      enable: false,
    },
    csrf: {
      ignoreJSON: true, //  false true  content-type  `application/json` 
    },
  };

  return config;
};

how do I configure config.sequelize if I want to operate multiple libraries here? Ask Daniel, thank you in cash

the method given by the official document is
config.sequelize = {
datasources: [

]
 {
    delegate: "ufModel",
    baseDir: "uf_model",
    database: "UFData_999_2011",
    dialect: "mssql", // support: mysql, mariadb, postgres, mssql
    host: "192.168.1.117",
    port: "1433",
    username: "sa",
    password: "1",
  }{
  }
  mysql 127.0.0.1 3306 datasources
  
 
Jul.08,2021

  

Why don't I talk about another database operation on my connection? Ask the bosses for advice! The teacher told me that I couldn't find out how to use my watch. There was something wrong with my usage.

Menu