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

fix: dropIndex now works when providing a tableIndex without name #8937

Merged
merged 1 commit into from
Aug 24, 2022
Merged

fix: dropIndex now works when providing a tableIndex without name #8937

merged 1 commit into from
Aug 24, 2022

Conversation

Thellior
Copy link
Contributor

Description of change

Fixes #8936

  • Added a protected generateIndexName on BaseQueryRunners that generates a index name
    • This code was the same on all createIndex function implementation thus made it a generic method
  • Added a if statement on all dropIndex methods of QueryRunners to generate a indexName if there is none on the TableIndex
  • Added github-issue unit test to verify that this solves the issue

Pull-Request Checklist

  • [ x] Code is up-to-date with the master branch
  • [ x] npm run format to apply prettier formatting
  • [ x] npm run test passes with this change
  • [ x] This pull request links relevant issues as Fixes #0000
  • [ x] There are new or updated unit tests validating the change
  • [ x] Documentation has been updated to reflect this change
  • [ x] The new commits follow conventions explained in CONTRIBUTING.md

const queryRunner: QueryRunner = connection.createQueryRunner()
const userRepository: Repository<User> =
connection.getRepository(User)
const tableName: string = userRepository.metadata.tableName
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't figure out what the best way was to get the tableName of the entity. If there is a better way I would like to know how so i can change it 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I cannot get the Oracle DB to work locally either on an intel and M1 machine. Is there some extra guidance available?. I checked the Developer documentation already and followed that steps

@pleerock pleerock requested a review from AlexMesser June 29, 2022 13:56
@Thellior
Copy link
Contributor Author

Thellior commented Aug 1, 2022

@pleerock Is there any update on this or something I can do about it in the mean time :)

@AlexMesser AlexMesser merged commit de8aaac into typeorm:master Aug 24, 2022
@AlexMesser
Copy link
Collaborator

thank you for contribution!

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

Successfully merging this pull request may close these issues.

DropIndex with a TableIndex without name is not working
2 participants