Skip to content
New issue

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

Cannot show any migrations using cli #9769

Open
1 of 18 tasks
thinkong opened this issue Feb 9, 2023 · 14 comments
Open
1 of 18 tasks

Cannot show any migrations using cli #9769

thinkong opened this issue Feb 9, 2023 · 14 comments

Comments

@thinkong
Copy link

thinkong commented Feb 9, 2023

Issue description

yarn typeorm migration:show -d ./src/data-sources.ts won't show anything

Expected Behavior

It should show me a list of migrations

Actual Behavior

doesn't show me any of the migrations i have generated

Steps to reproduce

From empty folder.. follow the instructions in the quickstart guide.. Except I used mysql and yarn.

Run yarn typeorm migration:generate -d .\src\data-source.ts init
move the created migration file to migration folder

change data-source to following.

import "reflect-metadata"
import { DataSource } from "typeorm"
import { User } from "./entity/User"

export const AppDataSource = new DataSource({
    type: "mysql",
    host: "localhost",
    port: 3306,
    username: "test",
    password: "test",
    database: "test",
    synchronize: true,
    logging: false,
    entities: [User],
    migrations: [join(__dirname, 'migration/*{.ts,.js}')],
    subscribers: [],
})

Then run migration:show yarn typeorm migration:show -d .\src\data-source.ts

It shows nothing..

My Environment

Dependency Version
Operating System Windows 11
Node.js version 16.18.0
Typescript version 4.5.2
TypeORM version 0.3.12

Also.. my mysql environment is on aws using aurora-mysql

Additional Context

No response

Relevant Database Driver(s)

  • aurora-mysql
  • aurora-postgres
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • spanner
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.

@Mauro-Domingues
Copy link

It started since latest version: ^0.3.12
Migration:generate and also migration:run aren't working

Captura de tela 2023-02-10 195252

image

@cduff
Copy link
Contributor

cduff commented Feb 14, 2023

Also reported as issue #9785?

May only occur when running on Windows machines? I'm able to work around by executing migration commands inside a Docker container.

@cduff
Copy link
Contributor

cduff commented Feb 14, 2023

Could be related to update of glob dependency from ^7.2.0 to ^8.1.0.

@rajansharma3097
Copy link

@cduff I'm also getting the same issue. Could you please help to resolve this issue asap?

I'm using the latest TypeOrm version: ^0.3.12
Database: MySQL
Node Version: v18.14.0
migration:generate and also migration:run aren't working

image

image

@alumni
Copy link
Contributor

alumni commented Feb 15, 2023

The issue is in the way TypeORM calls glob.sync. Since v8, \ is not allowed by default as path separator, which is the path separator on Windows.

Check the changelog for glob 8.1.0, they made a workaround to allow v7 behavior to continue working. I also made a quick fix for jorgebodega/typeorm-seeding#184 (in a slightly different way).

@MarcioJrios
Copy link

I'm migrating a project from typeorm 0.2 to 0.3 and started facing the same issue here.

@Mauro-Domingues
Copy link

I'm migrating a project from typeorm 0.2 to 0.3 and started facing the same issue here.

While the problem is not solved, revert your version to 0.3.11. Actually working perfectlly.

@alumni
Copy link
Contributor

alumni commented Feb 16, 2023

Duplicate of #9766

@rajansharma3097
Copy link

I'm migrating a project from typeorm 0.2 to 0.3 and started facing the same issue here.

While the problem is not solved, revert your version to 0.3.11. Actually working perfectlly.

@Mauro-Domingues Could you please share the example application with this change? Because I have tried the suggested change and it's not working. Also, if possible, could you please share your package.json and data-source.ts file?

@darwinsubramaniam
Copy link

The issue is in the 0.3.12 version , reverting to 0.3.11 working as per expected

@rajansharma3097
Copy link

rajansharma3097 commented Feb 22, 2023

The issue is in the 0.3.12 version , reverting to 0.3.11 working as per expected

@darwinsubramaniam I have tried this, but it's not working as expected. Now I'm not getting any error, but not getting anything either on running the command. If possible, could you please share your package.json and data-source.ts files?

@sujesh-t
Copy link

Is this fixed ? I am facing issues in v0.3.20

@Mauro-Domingues
Copy link

Is this fixed ? I am facing issues in v0.3.20

i can assure v0.3.15 is working correctly, i am currently on that version since they solved this.

@alumni
Copy link
Contributor

alumni commented Feb 21, 2024

Also working correctly in 0.3.20. This issue should've been closed already (it was introduced by the glob upgrade but worked around by normalizing paths in TypeORM).

@sujesh-t I would open a new ticket with some reproducible example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants