We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic informations:
How to specify the path of my migrations?
ts-node --require tsconfig-paths/register --require ./tsconfig.build.json ./node_modules/typeorm/cli --dataSource ./src/database/typeorm-data-source.ts migration:generate .\src\database\migrations\initial # Migration E:\DISK\Github\social-media-app\backend\nodejs-nest\src\database\migrations\initial.ts has been generated successfully. # Done in 3.97s. ts-node --require tsconfig-paths/register --require ./tsconfig.build.json ./node_modules/typeorm/cli --dataSource ./src/database/typeorm-data-source.ts migration:run # query: SELECT VERSION() AS `version` # query: SELECT * FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = 'test' AND `TABLE_NAME` = 'migrations' # query: SELECT * FROM `test`.`migrations` `migrations` ORDER BY `id` DESC # No migrations are pending
My DataSource:
import { Comment } from 'src/app/comments/entities/comment.entity'; import { Post } from 'src/app/posts/entities/post.entity'; import { User } from 'src/app/users/entities/user.entity'; import { DataSource } from 'typeorm'; import { SnakeNamingStrategy } from 'typeorm-naming-strategies'; const dataSource = new DataSource({ type: 'mysql', host: 'localhost', port: 3306, username: 'admin', password: '...', database: 'test', entities: [User, Comment, Post], migrations: ['src/app/database/migrations/*.ts'], namingStrategy: new SnakeNamingStrategy(), // synchronize: true, }); export default dataSource;
My directory schema, simplified (output by tree)
src/ ├── app │ ├── app.controller.spec.ts │ ├── app.controller.ts │ ├── app.module.ts │ ├── app.service.ts │ ├── auth/ │ ├── comments/ │ ├── posts/ │ └── users/ ├── database │ ├── database.module.ts │ ├── migrations │ │ └── 1650143775406-initial.ts │ ├── typeorm-data-source.ts ├── main.ts ├── tests │ └── test-schema.ts └── types └── global.d.ts
The text was updated successfully, but these errors were encountered:
I solve!
const dataSource = new DataSource({ migrations: ['**/app/database/migrations/*.ts'], });
Or
const dataSource = new DataSource({ migrations: [path.resolve(__dirname, 'migrations', '*.ts')], });
I feel more safe with 2nd style.
Sorry, something went wrong.
No branches or pull requests
Basic informations:
How to specify the path of my migrations?
My DataSource:
My directory schema, simplified (output by tree)
The text was updated successfully, but these errors were encountered: