From 3a570e50a116e7cdf49d7ae64ef3d2a30e3c4049 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Thu, 11 Mar 2021 15:48:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 14 ++++++-- .../version/1615447091566_migrate.go | 34 +++++++++++++++++++ 2 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 cmd/migrate/migration/version/1615447091566_migrate.go diff --git a/README.md b/README.md index 94c43209..f63b7e25 100644 --- a/README.md +++ b/README.md @@ -231,6 +231,15 @@ npm run dev +## 💎 主要成员 + + + + + + + + ## JetBrains 开源证书支持 `go-admin` 项目一直以来都是在 JetBrains 公司旗下的 GoLand 集成开发环境中进行开发,基于 **free JetBrains Open Source license(s)** 正版免费授权,在此表达我的谢意。 @@ -262,12 +271,11 @@ npm run dev zhuqiyun LLL狐 星星之火 cjj770 Sam 唐*i 晓聪 aLong *渊 海马 魏镇坪 + 111 *哥 我的宇哥哥 *声 *节 -## 🤝友情链接 +## 🤝 链接 [Go开发者成长线路图](http://www.golangroadmap.com/) ## 🔑 License [MIT](https://github.com/go-admin-team/go-admin/blob/master/LICENSE.md) -Copyright (c) 2020 wenjianzhang - +Copyright (c) 2020 wenjianzhang \ No newline at end of file diff --git a/cmd/migrate/migration/version/1615447091566_migrate.go b/cmd/migrate/migration/version/1615447091566_migrate.go new file mode 100644 index 00000000..961a8510 --- /dev/null +++ b/cmd/migrate/migration/version/1615447091566_migrate.go @@ -0,0 +1,34 @@ +package version + +import ( + "gorm.io/gorm" + "runtime" + + "go-admin/cmd/migrate/migration" + common "go-admin/common/models" +) + +func init() { + _, fileName, _, _ := runtime.Caller(0) + migration.Migrate.SetVersion(migration.GetFilename(fileName), _1615447091566Test) +} + +func _1615447091566Test(db *gorm.DB, version string) error { + return db.Transaction(func(tx *gorm.DB) error { + + // TODO: 这里开始写入要变更的内容 + + // TODO: 例如 修改表字段 使用过程中请删除此段代码 + sql1 := "INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `title`, `icon`, `path`, `paths`, `menu_type`, `action`, `permission`, `parent_id`, `no_cache`, `breadcrumb`, `component`, `sort`, `visible`, `create_by`, `update_by`, `is_frame`, `created_at`, `updated_at`, `deleted_at`) VALUES (522, 'SysContentCreate', '新增', 'form', 'syscontent/create', '/0/498/522', 'C', '', 'syscontent:syscontent:add', 498, 0, '', '/syscontent/create.vue', 0, '1', '1', '1', '1', '2020-11-08 17:00:35.259', '2020-11-12 22:55:50.739', NULL);" + + err := tx.Exec(sql1).Error + if err != nil { + return err + } + + + return tx.Create(&common.Migration{ + Version: version, + }).Error + }) +} \ No newline at end of file