gin-vue-admin
gin-vue-admin copied to clipboard
各个版本初始化数据方法
请对应版本进行观看初始化数据的方式 V2.0.0~V2.2.0
- 自行新建数据库,并导入server/db的qmPlus.sql
V2.3.0~V2.3.31
comfig.yaml的mysql的账号密码配置自行修改config.yaml中的system下存在一行need-init-data: false将此参数设定为true- 启动项目就自动通过代码方式进行初始化数据 切记初次开启后 记得关闭
V2.3.4~master
- 配置好
server/config.yaml的mysql中的path,db-name,username,password,其他的按需修改 - 我们 flipped-aurora 团队为各位使用者准备好了脚本
windows用户直接运行server目录下的initdb.bat(双击)linux,mac用户-
cd server make gva make initdb
说明 今后都会使用gva终端工具进行初始化数据,理由如下
- V2.3.0~V2.3.31所使用的方式,有人只会改成
true,第二次启动就忘了改为false, 导致server项目启动失败 - 方便新增数据,而不需要跟以前一样修改
.sql文件 - gva终端初始化数据是通过代码+gorm的事务进行添加数据,大概率不同版本的mysql之间一些问题的,规避了字符集的问题问题而导致数据的导入失败,或者乱码问题
where is "QmPlus.sql" ?
where is "QmPlus.sql" ?
Please check the corresponding version to see the initialization data
where is "QmPlus.sql" ? 拉取代码后看不到"QmPlus.sql" ?
where is "QmPlus.sql" ? 拉取代码后看不到"QmPlus.sql" ?
Please check the corresponding version to see the initialization data, Read the description of the issues carefully and find the initialization method for the corresponding version.
[Mysql]-->工作流相关 表的初始数据失败,err: Error 1292: Incorrect datetime value: '0000-00-00' for column 'due_date' at row 1
master, tag 2.4.0, 都没有initdb.bat, windows端要怎么弄?
master, tag 2.4.0, 都没有
initdb.bat, windows端要怎么弄?
if mysql config is correct,it's automatically created
SQLite无法创建初始化数据
SQLite无法创建初始化数据 自行微调代码适配SQLite
postgres 是已经完成了么
postgres 是已经完成了么
没有
代码为 master 最新版本。 我在一个数据库初始化好了,将 sql 导入另一个数据库,用新数据库启动直接报错。
启动执行如下 sql:
CREATE TABLE "sys_apis" ("id" bigserial,"created_at" timestamptz,"updated_at" timestamptz,"deleted_at" timestamptz,"path" text,"description" text,"api_group" text,"method" text DEFAULT 'POST',PRIMARY KEY ("id"))
报错如下:
ERROR: relation "sys_apis" already exists (SQLSTATE 42P07)
我有三个问题想和您请教:
- 程序初始化和我直接导入 sql 并修改配置文件的区别是什么?
- 您是通过什么判断是否初始化了,什么情况下需要迁移的呢?
- 怎样才能导入了 sql 并修改配置后就能直接跑起来而不需要初始化?
@piexlmax
@zcyc
- 程序初始化方便适配不同数据库,sql各种导入有这各种各样的问题
- 目前main通过判断GVA_DB变量判断是否初始化,迁移如果是指表结构的话,建议看gorm文档
- 很早就抛弃sql导入,不支持,自己解决