earthworm
earthworm copied to clipboard
[BUG] - 测试数据库库名的小错误
Describe the bug
在.env.example中,测试数据库应该是earthworm_test,写成了earthworm_nest,在启动的时候会报错找不到数据库
Reproduction
No response
Validations
- [X] Read the Contributing Guidelines.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] The provided reproduction is a minimal reproducible example of the bug.
这应该无所谓,要先创建.env文件,然后再将.env.example内容复制到.env文件中,然后修改.env文件中的数据库密码
需要先创建一个空的数据库earthworm_nest,然后再初始化数据库表结构
我的意思是作者应该是这里有个笔误,因为数据库里面好像默认有一个空的earthworm_test,所以应该是这里写错了,如果将.env.example里面的表名改成earthworm_test就不需要自己再去单独创建表,可以直接按照教程完成初始化
@squanchhhhh 你好,.env.example
是 .env
的示例文件,并不是测试文件,所以这里的对应 earthworm_nest 是正确的
测试文件 .env.test
对应的示例文件的是 .env.test.example
可以再仔细阅读下说明文档 😊
还有一个问题,MySQL 中并不会默认给你创建一个空的 earthworm_test 数据库,之所以你能看到自动创建了是因为我们在 docker-compose 中配置了对应需要创建的数据库,当你执行命令 pnpm docker:start
时就会创建
在这里也可以看到,有两个数据库,端口是 3306 和 3307,分别对应正常使用的数据库和测试使用的数据库,正常后端接口请求时访问的肯定是 earthworm_nest 这个数据库,之后跑后端测试的时候才会用到 earthworm_test
希望能解答你的疑惑~