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

QueryRunner.dropColumns doesnt accept list of column names as strings #7655

Closed
1 of 21 tasks
mateusppereira opened this issue May 14, 2021 · 0 comments · Fixed by #7654
Closed
1 of 21 tasks

QueryRunner.dropColumns doesnt accept list of column names as strings #7655

mateusppereira opened this issue May 14, 2021 · 0 comments · Fixed by #7654

Comments

@mateusppereira
Copy link
Contributor

Feature Description

Add support to an array of strings on dropColumns method.

The Problem

The current version of QueryRunner.dropColumns method only supports a list of TableColumns and it makes the code more verbosity and less consistent.

The Solution

The solutions was easy, since the dropColumn method already accept a string as column name.

For an specific driver I was forced to check if it was already an instance of TableColumn and, if not, I find the column on table.

Considered Alternatives

Additional Context

before:

await queryRunner.dropColumns(
  'table_x',
  [
    new TableColumn({ name: 'id', type: 'int' }),
    new TableColumn({ name: 'name', type: 'varchar' }),
  ],
)

after:

await queryRunner.dropColumns('table_x', ['id', 'name'])

Relevant Database Driver(s)

  • aurora-data-api
  • aurora-data-api-pg
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • 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.
  • Yes, I have the time, but I don't know how to start. I would need guidance.
  • No, I don't have the time, although I believe I could do it if I had the time...
  • No, I don't have the time and I wouldn't even know how to start.

I've already submitted a pull request #7654

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.

2 participants