earthworm icon indicating copy to clipboard operation
earthworm copied to clipboard

[BUG] - 测试数据库库名的小错误

Open squanchhhhh opened this issue 10 months ago • 3 comments

Describe the bug

在.env.example中,测试数据库应该是earthworm_test,写成了earthworm_nest,在启动的时候会报错找不到数据库

Reproduction

No response

Validations

squanchhhhh avatar Apr 09 '24 12:04 squanchhhhh

image 这应该无所谓,要先创建.env文件,然后再将.env.example内容复制到.env文件中,然后修改.env文件中的数据库密码 image 需要先创建一个空的数据库earthworm_nest,然后再初始化数据库表结构

gantoho avatar Apr 09 '24 14:04 gantoho

我的意思是作者应该是这里有个笔误,因为数据库里面好像默认有一个空的earthworm_test,所以应该是这里写错了,如果将.env.example里面的表名改成earthworm_test就不需要自己再去单独创建表,可以直接按照教程完成初始化

squanchhhhh avatar Apr 09 '24 14:04 squanchhhhh

@squanchhhhh 你好,.env.example.env 的示例文件,并不是测试文件,所以这里的对应 earthworm_nest 是正确的

测试文件 .env.test 对应的示例文件的是 .env.test.example

可以再仔细阅读下说明文档 😊

1712672472284

还有一个问题,MySQL 中并不会默认给你创建一个空的 earthworm_test 数据库,之所以你能看到自动创建了是因为我们在 docker-compose 中配置了对应需要创建的数据库,当你执行命令 pnpm docker:start 时就会创建

在这里也可以看到,有两个数据库,端口是 3306 和 3307,分别对应正常使用的数据库和测试使用的数据库,正常后端接口请求时访问的肯定是 earthworm_nest 这个数据库,之后跑后端测试的时候才会用到 earthworm_test

1712672815716

希望能解答你的疑惑~

fengstats avatar Apr 09 '24 14:04 fengstats