-
+
diff --git a/server/devops/api/form/mongo.go b/server/devops/api/form/mongo.go
new file mode 100644
index 00000000..ab8e4a94
--- /dev/null
+++ b/server/devops/api/form/mongo.go
@@ -0,0 +1,40 @@
+package form
+
+type Mongo struct {
+ Id uint64
+ Uri string `binding:"required" json:"uri"`
+ Name string `binding:"required" json:"name"`
+ ProjectId uint64 `binding:"required" json:"projectId"`
+ Project string `json:"project"`
+ Env string `json:"env"`
+ EnvId uint64 `binding:"required" json:"envId"`
+}
+
+type MongoCommand struct {
+ Database string `binding:"required" json:"database"`
+ Collection string `binding:"required" json:"collection"`
+ Filter map[string]interface{} `json:"filter"`
+}
+
+type MongoRunCommand struct {
+ Database string `binding:"required" json:"database"`
+ Command map[string]interface{} `json:"command"`
+}
+
+type MongoFindCommand struct {
+ MongoCommand
+ Sort map[string]interface{} `json:"sort"`
+ Skip int64
+ Limit int64
+}
+
+type MongoUpdateByIdCommand struct {
+ MongoCommand
+ DocId interface{} `binding:"required" json:"docId"`
+ Update map[string]interface{} `json:"update"`
+}
+
+type MongoInsertCommand struct {
+ MongoCommand
+ Doc map[string]interface{} `json:"doc"`
+}
diff --git a/server/devops/api/mongo.go b/server/devops/api/mongo.go
new file mode 100644
index 00000000..7ffd986e
--- /dev/null
+++ b/server/devops/api/mongo.go
@@ -0,0 +1,168 @@
+package api
+
+import (
+ "context"
+ "mayfly-go/base/biz"
+ "mayfly-go/base/ctx"
+ "mayfly-go/base/ginx"
+ "mayfly-go/base/utils"
+ "mayfly-go/server/devops/api/form"
+ "mayfly-go/server/devops/application"
+ "mayfly-go/server/devops/domain/entity"
+ "strconv"
+
+ "github.com/gin-gonic/gin"
+ "go.mongodb.org/mongo-driver/bson"
+ "go.mongodb.org/mongo-driver/bson/primitive"
+ "go.mongodb.org/mongo-driver/mongo/options"
+)
+
+type Mongo struct {
+ MongoApp application.Mongo
+}
+
+func (m *Mongo) Mongos(rc *ctx.ReqCtx) {
+ g := rc.GinCtx
+ mc := &entity.Mongo{EnvId: uint64(ginx.QueryInt(g, "envId", 0)),
+ ProjectId: uint64(ginx.QueryInt(g, "projectId", 0)),
+ }
+ mc.CreatorId = rc.LoginAccount.Id
+ rc.ResData = m.MongoApp.GetPageList(mc, ginx.GetPageParam(rc.GinCtx), new([]entity.Mongo))
+}
+
+func (m *Mongo) Save(rc *ctx.ReqCtx) {
+ form := &form.Mongo{}
+ ginx.BindJsonAndValid(rc.GinCtx, form)
+
+ rc.ReqParam = form
+
+ mongo := new(entity.Mongo)
+ utils.Copy(mongo, form)
+ mongo.SetBaseInfo(rc.LoginAccount)
+ m.MongoApp.Save(mongo)
+}
+
+func (m *Mongo) DeleteMongo(rc *ctx.ReqCtx) {
+ m.MongoApp.Delete(m.GetMongoId(rc.GinCtx))
+}
+
+func (m *Mongo) Databases(rc *ctx.ReqCtx) {
+ cli := m.MongoApp.GetMongoCli(m.GetMongoId(rc.GinCtx))
+ res, err := cli.ListDatabases(context.TODO(), bson.D{})
+ biz.ErrIsNilAppendErr(err, "获取mongo所有库信息失败: %s")
+ rc.ResData = res
+}
+
+func (m *Mongo) Collections(rc *ctx.ReqCtx) {
+ cli := m.MongoApp.GetMongoCli(m.GetMongoId(rc.GinCtx))
+ db := rc.GinCtx.Query("database")
+ biz.NotEmpty(db, "database不能为空")
+ ctx := context.TODO()
+ res, err := cli.Database(db).ListCollectionNames(ctx, bson.D{})
+ biz.ErrIsNilAppendErr(err, "获取库集合信息失败: %s")
+ rc.ResData = res
+}
+
+func (m *Mongo) RunCommand(rc *ctx.ReqCtx) {
+ commandForm := new(form.MongoRunCommand)
+ ginx.BindJsonAndValid(rc.GinCtx, commandForm)
+ cli := m.MongoApp.GetMongoCli(m.GetMongoId(rc.GinCtx))
+
+ ctx := context.TODO()
+ var bm bson.M
+ err := cli.Database(commandForm.Database).RunCommand(
+ ctx,
+ commandForm.Command,
+ ).Decode(&bm)
+
+ biz.ErrIsNilAppendErr(err, "执行命令失败: %s")
+ rc.ResData = bm
+}
+
+func (m *Mongo) FindCommand(rc *ctx.ReqCtx) {
+ g := rc.GinCtx
+ cli := m.MongoApp.GetMongoCli(m.GetMongoId(g))
+ commandForm := new(form.MongoFindCommand)
+ ginx.BindJsonAndValid(g, commandForm)
+
+ limit := commandForm.Limit
+ if limit != 0 {
+ biz.IsTrue(limit <= 100, "limit不能超过100")
+ }
+ opts := options.Find().SetSort(commandForm.Sort).
+ SetSkip(commandForm.Skip).
+ SetLimit(limit)
+ ctx := context.TODO()
+ cur, err := cli.Database(commandForm.Database).Collection(commandForm.Collection).Find(ctx, commandForm.Filter, opts)
+ biz.ErrIsNilAppendErr(err, "命令执行失败: %s")
+
+ var res []bson.M
+ cur.All(ctx, &res)
+ rc.ResData = res
+}
+
+func (m *Mongo) UpdateByIdCommand(rc *ctx.ReqCtx) {
+ g := rc.GinCtx
+ cli := m.MongoApp.GetMongoCli(m.GetMongoId(g))
+ commandForm := new(form.MongoUpdateByIdCommand)
+ ginx.BindJsonAndValid(g, commandForm)
+
+ // 解析docId文档id,如果为string类型则使用ObjectId解析,解析失败则为普通字符串
+ docId := commandForm.DocId
+ docIdVal, ok := docId.(string)
+ if ok {
+ objId, err := primitive.ObjectIDFromHex(docIdVal)
+ if err == nil {
+ docId = objId
+ }
+ }
+
+ res, err := cli.Database(commandForm.Database).Collection(commandForm.Collection).UpdateByID(context.TODO(), docId, commandForm.Update)
+ biz.ErrIsNilAppendErr(err, "命令执行失败: %s")
+
+ rc.ReqParam = commandForm
+ rc.ResData = res
+}
+
+func (m *Mongo) DeleteByIdCommand(rc *ctx.ReqCtx) {
+ g := rc.GinCtx
+ cli := m.MongoApp.GetMongoCli(m.GetMongoId(g))
+ commandForm := new(form.MongoUpdateByIdCommand)
+ ginx.BindJsonAndValid(g, commandForm)
+
+ // 解析docId文档id,如果为string类型则使用ObjectId解析,解析失败则为普通字符串
+ docId := commandForm.DocId
+ docIdVal, ok := docId.(string)
+ if ok {
+ objId, err := primitive.ObjectIDFromHex(docIdVal)
+ if err == nil {
+ docId = objId
+ }
+ }
+
+ res, err := cli.Database(commandForm.Database).Collection(commandForm.Collection).DeleteOne(context.TODO(), bson.D{{"_id", docId}})
+ biz.ErrIsNilAppendErr(err, "命令执行失败: %s")
+
+ rc.ReqParam = commandForm
+ rc.ResData = res
+}
+
+func (m *Mongo) InsertOneCommand(rc *ctx.ReqCtx) {
+ g := rc.GinCtx
+ cli := m.MongoApp.GetMongoCli(m.GetMongoId(g))
+ commandForm := new(form.MongoInsertCommand)
+ ginx.BindJsonAndValid(g, commandForm)
+
+ res, err := cli.Database(commandForm.Database).Collection(commandForm.Collection).InsertOne(context.TODO(), commandForm.Doc)
+ biz.ErrIsNilAppendErr(err, "命令执行失败: %s")
+
+ rc.ReqParam = commandForm
+ rc.ResData = res
+}
+
+// 获取请求路径上的mongo id
+func (m *Mongo) GetMongoId(g *gin.Context) uint64 {
+ dbId, _ := strconv.Atoi(g.Param("id"))
+ biz.IsTrue(dbId > 0, "mongoId错误")
+ return uint64(dbId)
+}
diff --git a/server/devops/application/mongo_app.go b/server/devops/application/mongo_app.go
new file mode 100644
index 00000000..2ffe180b
--- /dev/null
+++ b/server/devops/application/mongo_app.go
@@ -0,0 +1,133 @@
+package application
+
+import (
+ "context"
+ "mayfly-go/base/biz"
+ "mayfly-go/base/cache"
+ "mayfly-go/base/global"
+ "mayfly-go/base/model"
+ "mayfly-go/server/devops/domain/entity"
+ "mayfly-go/server/devops/domain/repository"
+ "mayfly-go/server/devops/infrastructure/persistence"
+ "time"
+
+ "go.mongodb.org/mongo-driver/mongo"
+ "go.mongodb.org/mongo-driver/mongo/options"
+)
+
+type Mongo interface {
+ // 分页获取机器脚本信息列表
+ GetPageList(condition *entity.Mongo, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult
+
+ Count(condition *entity.Mongo) int64
+
+ // 根据条件获取
+ GetBy(condition *entity.Mongo, cols ...string) error
+
+ // 根据id获取
+ GetById(id uint64, cols ...string) *entity.Mongo
+
+ Save(entity *entity.Mongo)
+
+ // 删除数据库信息
+ Delete(id uint64)
+
+ // 获取mongo连接client
+ // @param id mongo id
+ GetMongoCli(id uint64) *mongo.Client
+}
+
+type mongoAppImpl struct {
+ mongoRepo repository.Mongo
+}
+
+var MongoApp Mongo = &mongoAppImpl{
+ mongoRepo: persistence.MongoDao,
+}
+
+// 分页获取数据库信息列表
+func (d *mongoAppImpl) GetPageList(condition *entity.Mongo, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult {
+ return d.mongoRepo.GetList(condition, pageParam, toEntity, orderBy...)
+}
+
+func (d *mongoAppImpl) Count(condition *entity.Mongo) int64 {
+ return d.mongoRepo.Count(condition)
+}
+
+// 根据条件获取
+func (d *mongoAppImpl) GetBy(condition *entity.Mongo, cols ...string) error {
+ return d.mongoRepo.Get(condition, cols...)
+}
+
+// 根据id获取
+func (d *mongoAppImpl) GetById(id uint64, cols ...string) *entity.Mongo {
+ return d.mongoRepo.GetById(id, cols...)
+}
+
+func (d *mongoAppImpl) Delete(id uint64) {
+ d.mongoRepo.Delete(id)
+ DeleteMongoCache(id)
+}
+
+func (d *mongoAppImpl) Save(m *entity.Mongo) {
+ if m.Id == 0 {
+ d.mongoRepo.Insert(m)
+ } else {
+ // 先关闭连接
+ DeleteMongoCache(m.Id)
+ d.mongoRepo.Update(m)
+ }
+}
+
+func (d *mongoAppImpl) GetMongoCli(id uint64) *mongo.Client {
+ cli, err := GetMongoCli(id, func(u uint64) string {
+ mongo := d.GetById(id)
+ biz.NotNil(mongo, "mongo信息不存在")
+ return mongo.Uri
+ })
+ biz.ErrIsNilAppendErr(err, "连接mongo失败: %s")
+ return cli
+}
+
+// -----------------------------------------------------------
+
+//mongo客户端连接缓存,30分钟内没有访问则会被关闭
+var mongoCliCache = cache.NewTimedCache(30*time.Minute, 5*time.Second).
+ WithUpdateAccessTime(true).
+ OnEvicted(func(key interface{}, value interface{}) {
+ global.Log.Info("关闭mongo连接: id = ", key)
+ value.(*mongo.Client).Disconnect(context.TODO())
+ })
+
+func GetMongoCli(mongoId uint64, getMongoUri func(uint64) string) (*mongo.Client, error) {
+ cli, err := mongoCliCache.ComputeIfAbsent(mongoId, func(key interface{}) (interface{}, error) {
+ c, err := connect(getMongoUri(mongoId))
+ if err != nil {
+ return nil, err
+ }
+ return c, nil
+ })
+
+ if cli != nil {
+ return cli.(*mongo.Client), err
+ }
+ return nil, err
+}
+
+func DeleteMongoCache(mongoId uint64) {
+ mongoCliCache.Delete(mongoId)
+}
+
+// 连接mongo,并返回client
+func connect(uri string) (*mongo.Client, error) {
+ ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
+ defer cancel()
+ client, err := mongo.Connect(ctx, options.Client().ApplyURI(uri).SetMaxPoolSize(2))
+ if err != nil {
+ return nil, err
+ }
+ if err = client.Ping(context.TODO(), nil); err != nil {
+ return nil, err
+ }
+ return client, err
+}
diff --git a/server/devops/domain/entity/mongo.go b/server/devops/domain/entity/mongo.go
new file mode 100644
index 00000000..dfdc2407
--- /dev/null
+++ b/server/devops/domain/entity/mongo.go
@@ -0,0 +1,14 @@
+package entity
+
+import "mayfly-go/base/model"
+
+type Mongo struct {
+ model.Model
+
+ Name string `orm:"column(name)" json:"name"`
+ Uri string `orm:"column(uri)" json:"uri"`
+ ProjectId uint64 `json:"projectId"`
+ Project string `json:"project"`
+ EnvId uint64 `json:"envId"`
+ Env string `json:"env"`
+}
diff --git a/server/devops/domain/repository/mongo.go b/server/devops/domain/repository/mongo.go
new file mode 100644
index 00000000..db1a10bb
--- /dev/null
+++ b/server/devops/domain/repository/mongo.go
@@ -0,0 +1,25 @@
+package repository
+
+import (
+ "mayfly-go/base/model"
+ "mayfly-go/server/devops/domain/entity"
+)
+
+type Mongo interface {
+ // 分页获取列表
+ GetList(condition *entity.Mongo, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult
+
+ Count(condition *entity.Mongo) int64
+
+ // 根据条件获取
+ Get(condition *entity.Mongo, cols ...string) error
+
+ // 根据id获取
+ GetById(id uint64, cols ...string) *entity.Mongo
+
+ Insert(db *entity.Mongo)
+
+ Update(db *entity.Mongo)
+
+ Delete(id uint64)
+}
diff --git a/server/devops/infrastructure/persistence/mongo_repo.go b/server/devops/infrastructure/persistence/mongo_repo.go
new file mode 100644
index 00000000..fe3744c6
--- /dev/null
+++ b/server/devops/infrastructure/persistence/mongo_repo.go
@@ -0,0 +1,61 @@
+package persistence
+
+import (
+ "fmt"
+ "mayfly-go/base/biz"
+ "mayfly-go/base/model"
+ "mayfly-go/server/devops/domain/entity"
+ "mayfly-go/server/devops/domain/repository"
+)
+
+type mongoRepo struct{}
+
+var MongoDao repository.Mongo = &mongoRepo{}
+
+// 分页获取数据库信息列表
+func (d *mongoRepo) GetList(condition *entity.Mongo, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult {
+ sql := "SELECT d.* FROM t_mongo d JOIN t_project_member pm ON d.project_id = pm.project_id WHERE 1 = 1 "
+ if condition.CreatorId != 0 {
+ // 使用创建者id模拟项目成员id
+ sql = fmt.Sprintf("%s AND pm.account_id = %d", sql, condition.CreatorId)
+ }
+ if condition.ProjectId != 0 {
+ sql = fmt.Sprintf("%s AND d.project_id = %d", sql, condition.ProjectId)
+ }
+ if condition.EnvId != 0 {
+ sql = fmt.Sprintf("%s AND d.env_id = %d", sql, condition.EnvId)
+ }
+ sql = sql + " ORDER BY d.create_time DESC"
+ return model.GetPageBySql(sql, pageParam, toEntity)
+}
+
+func (d *mongoRepo) Count(condition *entity.Mongo) int64 {
+ return model.CountBy(condition)
+}
+
+// 根据条件获取
+func (d *mongoRepo) Get(condition *entity.Mongo, cols ...string) error {
+ return model.GetBy(condition, cols...)
+}
+
+// 根据id获取
+func (d *mongoRepo) GetById(id uint64, cols ...string) *entity.Mongo {
+ db := new(entity.Mongo)
+ if err := model.GetById(db, id, cols...); err != nil {
+ return nil
+
+ }
+ return db
+}
+
+func (d *mongoRepo) Insert(db *entity.Mongo) {
+ biz.ErrIsNil(model.Insert(db), "新增mongo信息失败")
+}
+
+func (d *mongoRepo) Update(db *entity.Mongo) {
+ biz.ErrIsNil(model.UpdateById(db), "更新mongo信息失败")
+}
+
+func (d *mongoRepo) Delete(id uint64) {
+ model.DeleteById(new(entity.Mongo), id)
+}
diff --git a/server/devops/router/mongo.go b/server/devops/router/mongo.go
new file mode 100644
index 00000000..f24c2333
--- /dev/null
+++ b/server/devops/router/mongo.go
@@ -0,0 +1,86 @@
+package router
+
+import (
+ "mayfly-go/base/ctx"
+ "mayfly-go/server/devops/api"
+ "mayfly-go/server/devops/application"
+
+ "github.com/gin-gonic/gin"
+)
+
+func InitMongoRouter(router *gin.RouterGroup) {
+ m := router.Group("mongos")
+ {
+ ma := &api.Mongo{
+ MongoApp: application.MongoApp,
+ }
+
+ // 获取所有mongo列表
+ m.GET("", func(c *gin.Context) {
+ ctx.NewReqCtxWithGin(c).
+ Handle(ma.Mongos)
+ })
+
+ saveMongo := ctx.NewLogInfo("保存mongo信息")
+ m.POST("", func(c *gin.Context) {
+ ctx.NewReqCtxWithGin(c).
+ WithLog(saveMongo).
+ Handle(ma.Save)
+ })
+
+ deleteMongo := ctx.NewLogInfo("删除mongo信息")
+ m.DELETE(":id", func(c *gin.Context) {
+ ctx.NewReqCtxWithGin(c).
+ WithLog(deleteMongo).
+ Handle(ma.DeleteMongo)
+ })
+
+ // 获取mongo下的所有数据库
+ m.GET(":id/databases", func(c *gin.Context) {
+ ctx.NewReqCtxWithGin(c).
+ Handle(ma.Databases)
+ })
+
+ // 获取mongo指定库的所有集合
+ m.GET(":id/collections", func(c *gin.Context) {
+ ctx.NewReqCtxWithGin(c).
+ Handle(ma.Collections)
+ })
+
+ // 获取mongo runCommand
+ m.POST(":id/run-command", func(c *gin.Context) {
+ ctx.NewReqCtxWithGin(c).
+ Handle(ma.RunCommand)
+ })
+
+ // 执行mongo find命令
+ m.POST(":id/command/find", func(c *gin.Context) {
+ ctx.NewReqCtxWithGin(c).
+ Handle(ma.FindCommand)
+ })
+
+ // 执行mongo update by id命令
+ updateDocById := ctx.NewLogInfo("mongo-更新文档")
+ m.POST(":id/command/update-by-id", func(c *gin.Context) {
+ ctx.NewReqCtxWithGin(c).
+ WithLog(updateDocById).
+ Handle(ma.UpdateByIdCommand)
+ })
+
+ // 执行mongo delete by id命令
+ deleteDoc := ctx.NewLogInfo("mongo-删除文档")
+ m.POST(":id/command/delete-by-id", func(c *gin.Context) {
+ ctx.NewReqCtxWithGin(c).
+ WithLog(deleteDoc).
+ Handle(ma.DeleteByIdCommand)
+ })
+
+ // 执行mongo insert 命令
+ insertDoc := ctx.NewLogInfo("mongo-新增文档")
+ m.POST(":id/command/insert", func(c *gin.Context) {
+ ctx.NewReqCtxWithGin(c).
+ WithLog(insertDoc).
+ Handle(ma.InsertOneCommand)
+ })
+ }
+}
diff --git a/server/initialize/router.go b/server/initialize/router.go
index a8961184..f904b8e6 100644
--- a/server/initialize/router.go
+++ b/server/initialize/router.go
@@ -60,6 +60,7 @@ func InitRouter() *gin.Engine {
devops_router.InitMachineRouter(api)
devops_router.InitMachineScriptRouter(api)
devops_router.InitMachineFileRouter(api)
+ devops_router.InitMongoRouter(api)
}
return router
diff --git a/server/mayfly-go.sql b/server/mayfly-go.sql
index 92e331d1..15007da8 100644
--- a/server/mayfly-go.sql
+++ b/server/mayfly-go.sql
@@ -401,6 +401,11 @@ INSERT INTO `t_sys_resource` VALUES (64, 63, 2, 1, '基本权限', 'redis:manage
INSERT INTO `t_sys_resource` VALUES (70, 48, 2, 1, '项目删除', 'project:del', 6, 'null', 1, 'admin', 1, 'admin', '2021-08-17 11:20:37', '2021-08-17 11:20:37');
INSERT INTO `t_sys_resource` VALUES (71, 61, 2, 1, '数据保存', 'redis:data:save', 6, 'null', 1, 'admin', 1, 'admin', '2021-08-17 11:20:37', '2021-08-17 11:20:37');
INSERT INTO `t_sys_resource` VALUES (72, 3, 2, 1, '终止进程', 'machine:killprocess', 6, 'null', 1, 'admin', 1, 'admin', '2021-08-17 11:20:37', '2021-08-17 11:20:37');
+INSERT INTO `t_sys_resource`(`id`, `pid`, `type`, `status`, `name`, `code`, `weight`, `meta`, `creator_id`, `creator`, `modifier_id`, `modifier`, `create_time`, `update_time`) VALUES (79, 2, 1, 1, 'Mongo', 'mongo', 5, '{\"icon\":\"Document\",\"isKeepAlive\":true,\"routeName\":\"Mongo\"}', 1, 'admin', 1, 'admin', '2022-05-13 14:00:41', '2022-05-13 14:00:52');
+INSERT INTO `t_sys_resource`(`id`, `pid`, `type`, `status`, `name`, `code`, `weight`, `meta`, `creator_id`, `creator`, `modifier_id`, `modifier`, `create_time`, `update_time`) VALUES (80, 79, 1, 1, '数据操作', 'mongo-data-operation', 1, '{\"component\":\"MongoDataOp\",\"icon\":\"Document\",\"isKeepAlive\":true,\"routeName\":\"MongoDataOp\"}', 1, 'admin', 1, 'admin', '2022-05-13 14:03:58', '2022-05-14 20:16:07');
+INSERT INTO `t_sys_resource`(`id`, `pid`, `type`, `status`, `name`, `code`, `weight`, `meta`, `creator_id`, `creator`, `modifier_id`, `modifier`, `create_time`, `update_time`) VALUES (81, 80, 2, 1, '基本权限', 'mongo:base', 1, 'null', 1, 'admin', 1, 'admin', '2022-05-13 14:04:16', '2022-05-13 14:04:16');
+INSERT INTO `t_sys_resource`(`id`, `pid`, `type`, `status`, `name`, `code`, `weight`, `meta`, `creator_id`, `creator`, `modifier_id`, `modifier`, `create_time`, `update_time`) VALUES (82, 79, 1, 1, 'Mongo管理', 'mongo-manage', 2, '{\"component\":\"MongoList\",\"icon\":\"Menu\",\"isKeepAlive\":true,\"routeName\":\"MongoList\"}', 1, 'admin', 1, 'admin', '2022-05-16 18:13:06', '2022-05-16 18:13:06');
+INSERT INTO `t_sys_resource`(`id`, `pid`, `type`, `status`, `name`, `code`, `weight`, `meta`, `creator_id`, `creator`, `modifier_id`, `modifier`, `create_time`, `update_time`) VALUES (83, 82, 2, 1, '基本权限', 'mongo:manage:base', 1, 'null', 1, 'admin', 1, 'admin', '2022-05-16 18:13:25', '2022-05-16 18:13:25');
COMMIT;
-- ----------------------------
@@ -599,4 +604,27 @@ INSERT INTO `t_sys_role_resource` VALUES (498, 8, 63, 1, 'admin', '2021-11-05 15
INSERT INTO `t_sys_role_resource` VALUES (499, 8, 64, 1, 'admin', '2021-11-05 15:59:16');
COMMIT;
+
+-- ----------------------------
+-- Table structure for t_mongo
+-- ----------------------------
+DROP TABLE IF EXISTS `t_mongo`;
+CREATE TABLE `t_mongo` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `name` varchar(36) COLLATE utf8mb4_bin NOT NULL COMMENT '名称',
+ `uri` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '连接uri',
+ `project_id` bigint(20) NOT NULL,
+ `project` varchar(36) COLLATE utf8mb4_bin DEFAULT NULL,
+ `env_id` bigint(20) DEFAULT NULL,
+ `env` varchar(36) COLLATE utf8mb4_bin DEFAULT NULL,
+ `create_time` datetime NOT NULL,
+ `creator_id` bigint(20) DEFAULT NULL,
+ `creator` varchar(36) COLLATE utf8mb4_bin DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `modifier_id` bigint(20) DEFAULT NULL,
+ `modifier` varchar(36) COLLATE utf8mb4_bin DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
+
+
SET FOREIGN_KEY_CHECKS = 1;