Browse Source

数据库连接信息

zmq 1 year ago
parent
commit
92f7e9d05c
1 changed files with 93 additions and 2 deletions
  1. 93 2
      src/hosts/ZhonTai.Host/Configs/dbconfig.Development.json

+ 93 - 2
src/hosts/ZhonTai.Host/Configs/dbconfig.Development.json

@@ -1,8 +1,99 @@
 {
+  //数据库注册键
+  "key": "admindb",
+
+  //程序集名称,自动获取实体表,为空则通过ConfigureFreeSql自定义配置
+  "assemblyNames": [ "ZhonTai.Admin" ],
+
   //监听所有操作
   "monitorCommand": false,
   //监听Curd操作
   "curd": true,
-  //同步更新数据
-  "sysUpdateData": true
+  //监听同步结构脚本
+  "syncStructureSql": false,
+  //监听同步数据Curd操作
+  "syncDataCurd": false,
+
+  //建库,Sqlite数据库不用配置建库,连接语句自动建库
+  "createDb": false,
+  //SqlServer,PostgreSQL,Oracle,OdbcOracle,OdbcSqlServer,OdbcMySql,OdbcPostgreSQL,Odbc,OdbcDameng,MsAccess
+  //建库连接字符串
+  //MySql "Server=localhost; Port=3306; Database=mysql; Uid=root; Pwd=pwd; Charset=utf8mb4;SslMode=none;Min pool size=1"
+  //SqlServer "Data Source=.;User Id=sa;Password=pwd;Initial Catalog=master;TrustServerCertificate=true;Pooling=true;Min Pool Size=1"
+  //PostgreSQL "Host=localhost;Port=5432;Username=postgres;Password=; Database=postgres;Pooling=true;Minimum Pool Size=1",
+  "createDbConnectionString": "Server=192.144.191.50; Port=3306; Database=jiujiu_zhongjie5; Uid=jiujiu_zhongjie5; Pwd=EjmCA6Ff4bSmKk32; Charset=utf8mb4;",
+  //建库脚本,复杂建库脚本可放到createdbsql.txt中
+  //MySql "CREATE DATABASE `admindb` CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_general_ci'"
+  //SqlServer "CREATE DATABASE [admindb]"
+  //PostgreSQL "CREATE DATABASE \"admindb\" WITH ENCODING = 'UTF8'"
+  "createDbSql": "CREATE DATABASE `jiujiu_zhongjie5` CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_general_ci'",
+
+  //同步结构
+  "syncStructure": true,
+  //同步数据,只新增数据不修改数据,想要修改数据需开启sysUpdateData
+  "syncData": true,
+  //同步更新数据,注意生产环境谨慎开启,确定要修改表数据是最新数据再开启。如不想更新某些表的数据,可以先配置同步数据排除表syncDataExcludeTables,再执行数据更新操作
+  "sysUpdateData": false,
+  //同步数据地址
+  //"SyncDataPath": "InitData/Admin/Vue2",
+  //同步所有表["ad_dict_type", "ad_dict", "ad_user",  "ad_user_staff", "ad_org", "ad_role", "ad_api", "ad_view", "ad_permission", "ad_permission_api", "ad_user_role", "ad_user_org", "ad_role_permission", "ad_tenant", "ad_tenant_permission"]
+  //同步指定表["ad_api", "ad_view", "ad_permission", "ad_permission_api"]
+  //同步数据包含表,指定表同步,不填同步所有表
+  "syncDataIncludeTables": [],
+  //同步排除表["ad_user"]
+  //同步数据排除表,指定表不同步
+  "syncDataExcludeTables": [],
+  //同步数据操作用户
+  "syncDataUser": {
+    "id": 161223411986501,
+    "userName": "admin",
+    "tenantId": 161223412138053
+  },
+
+  //项目初始化不开启生成数据,发布生产环境前,如果开发环境有配置数据需要更新数据包,可以开启生成数据包,使用完记得关闭
+  //开启生成数据前先关闭createDb syncStructure syncData sysUpdateData
+  //生成数据,回写InitData/Admin/*.json
+  "generateData": false,
+
+  //数据库配置 https://github.com/dotnetcore/FreeSql/wiki/入门
+  //数据库类型 MySql = 0, SqlServer = 1, PostgreSQL = 2, Oracle = 3, Sqlite = 4, OdbcOracle = 5, OdbcSqlServer = 6, OdbcMySql = 7, OdbcPostgreSQL = 8, Odbc = 9, OdbcDameng = 10, MsAccess = 11, Dameng = 12, OdbcKingbaseES = 13, ShenTong = 14, KingbaseES = 15, Firebird = 16
+  "type": "MySql",
+  //连接字符串
+  //MySql "Server=localhost; Port=3306; Database=admindb; Uid=root; Pwd=pwd; Charset=utf8mb4;SslMode=none;Min pool size=1"
+  //SqlServer "Data Source=.;User Id=sa;Password=pwd;Initial Catalog=admindb;TrustServerCertificate=true;Pooling=true;Min Pool Size=1"
+  //PostgreSQL "Host=localhost;Port=5432;Username=postgres;Password=; Database=admindb;Pooling=true;Minimum Pool Size=1"
+  //Sqlite "Data Source=|DataDirectory|\\admindb.db; Pooling=true;Min Pool Size=1"
+  "connectionString": "Server=192.144.191.50; Port=3306; Database=jiujiu_zhongjie5; Uid=jiujiu_zhongjie5; Pwd=EjmCA6Ff4bSmKk32; Charset=utf8mb4;SslMode=none;Min pool size=1",
+
+  //指定程序集
+  //FreeSql.MySql.MySqlProvider`1,FreeSql.Provider.MySqlConnector
+  "providerType": "",
+
+  //读写分离从库列表
+  "slaveList": [
+    //{
+    //  //连接字符串
+    //  "ConnectionString": "Data Source=|DataDirectory|\\admindb.db; Pooling=true;Min Pool Size=1",
+    //  //权重
+    //  "Weight": 1
+    //}
+  ],
+
+  //空闲时间(分),设置idleTime=0则不自动回收, 设置1天不使用则自动回收
+  "idleTime": 1440,
+
+  //多数据库
+  //定义DbKeys枚举
+  //使用仓储访问 public ModuleRepository(UnitOfWorkManagerCloud muowm) : base(DbKeys.AppDb, muowm)
+  //使用FreeSqlCloud访问  freeSqlCloud.Use(DbKeys.AppDb);
+  "dbs": [
+    //{
+    //  "key": "appdb",
+    //  "type": "Sqlite",
+    //  "syncStructure": false,
+    //  "syncData": false,
+    //  "connectionString": "Data Source=|DataDirectory|\\appdb.db; Pooling=true;Min Pool Size=1",
+    //  "providerType": ""
+    //}
+  ]
 }