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

Error trying to revert last migration when there is none on Oracle #11231

Open
1 of 18 tasks
mjr128 opened this issue Jan 8, 2025 · 0 comments · May be fixed by #11232
Open
1 of 18 tasks

Error trying to revert last migration when there is none on Oracle #11231

mjr128 opened this issue Jan 8, 2025 · 0 comments · May be fixed by #11232

Comments

@mjr128
Copy link

mjr128 commented Jan 8, 2025

Issue description

Running typeorm migration:revert command make oracle driver throw NJS-104 error

Expected Behavior

Having a nice message saying there is nothing to do and close gracefully.

Actual Behavior

Running typeorm migration:revert when there is no migration to revert (migrations table is empty) make the following output :

No migrations were found in the database. Nothing to revert!
Error during migration revert:
Error: NJS-104: connection pool cannot be closed because connections are busy
    at Object.throwErr (C:\Users\aperez3\Documents\dev\coopco\node_modules\.pnpm\oracledb@6.3.0\node_modules\oracledb\lib\errors.js:603:10)
    at Pool.close (C:\Users\aperez3\Documents\dev\coopco\node_modules\.pnpm\oracledb@6.3.0\node_modules\oracledb\lib\pool.js:295:14)
    at Pool.close [as terminate] (C:\Users\aperez3\Documents\dev\coopco\node_modules\.pnpm\oracledb@6.3.0\node_modules\oracledb\lib\util.js:134:10)
    at C:\Users\aperez3\Documents\dev\coopco\node_modules\.pnpm\typeorm@0.3.19_oracledb@6.3.0\node_modules\typeorm\driver\oracle\OracleDriver.js:854:18
    at new Promise (<anonymous>)
    at OracleDriver.closePool (C:\Users\aperez3\Documents\dev\coopco\node_modules\.pnpm\typeorm@0.3.19_oracledb@6.3.0\node_modules\typeorm\driver\oracle\OracleDriver.js:853:16)
    at OracleDriver.disconnect (C:\Users\aperez3\Documents\dev\coopco\node_modules\.pnpm\typeorm@0.3.19_oracledb@6.3.0\node_modules\typeorm\driver\oracle\OracleDriver.js:255:20)
    at DataSource.destroy (C:\Users\aperez3\Documents\dev\coopco\node_modules\.pnpm\typeorm@0.3.19_oracledb@6.3.0\node_modules\typeorm\data-source\DataSource.js:184:27)
    at Object.handler (C:\Users\aperez3\Documents\dev\coopco\node_modules\.pnpm\typeorm@0.3.19_oracledb@6.3.0\node_modules\typeorm\commands\MigrationRevertCommand.js:68:30)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'NJS-104'

Steps to reproduce

Create empty typeorm project and connect it to an oracle database.

Run typeorm migration:revert command

My Environment

Dependency Version
Operating System Windows 11
Node.js version v20.12.2
Typescript version 5.7.2
TypeORM version 0.3.20
oracledb 6.3.0
Database version 19c

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?

Yes, I have the time, and I know how to start.

mjr128 pushed a commit to mjr128/typeorm that referenced this issue Jan 9, 2025
avoid error when there is nothing to revert because datasource is destroyed and query runner
is not released

fix: Error trying to revert last migration when there is none on Oracle
Closes: typeorm#11231
@mjr128 mjr128 linked a pull request Jan 9, 2025 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant