我的后端迁移存在问题。它正在工作。我在Windows 10 PRO和数据库上运行docker。按照我的代码的链接下面的内容。
https://github.com/fabioniglio/project-gobarber-Backend
当我执行yarn typeorm迁移时:运行应该运行所有迁移,但是什么也不做,也不给出任何错误。
下面是我的docker-compose和ormconfig的配置。
docker-compose.yml
version: "3.7"
services:
postgres:
networks:
- test
image: postgres
ports:
- 5432:5432
environment:
POSTGRES_DB: gostack_gobarber
POSTGRES_USER: postgres
POSTGRES_PASSWORD: docker
container_name: gostack_gobarber
mongodb:
networks:
- test
image: mongo
ports:
- 27017:27017
container_name: mongodb
redis:
networks:
- test
image: redis:alpine
ports:
- 6379:6379
container_name: redis
networks:
test:
external:
name: nat
ormconfig.json
[
{
"name": "default",
"type": "postgres",
"host": "localhost",
"port": 5432,
"username": "postgres",
"password": "docker",
"database": "gostack_gobarber",
"entities": ["./src/modules/**/infra/typeorm/entities/*.ts"],
"migrations": ["./src/shared/infra/typeorm/migrations/*.ts"],
"cli": {
"migrationsDir": "./src/shared/infra/typeorm/migrations"
}
},
{
"name": "mongo",
"type": "mongodb",
"host": "localhost",
"port": 27017,
"database": "gobarber",
"useUnifiedTopology": true,
"entities": ["./src/modules/**/infra/typeorm/schemas/*.ts"]
}
]
运行迁移
C:\Users\Fabio Niglio\Documents\projects\bootcamp\Modulo5\primeiro-projeto-node>yarn typeorm migration:run
yarn run v1.22.0
$ ts-node-dev -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:run
Using ts-node version 8.8.2, typescript version 3.8.3
Done in 1.87s.