Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Kytech
Copy link
Contributor

@Kytech Kytech commented May 26, 2022

Since oracle database 12.2, database object names longer than 30 characters has been supported. This PR dynamically sets the maximum character limit for names generated in oracledb based on either the version specified using the version attribute in the knex configuration, or it will auto-detect the version number if it is not specified (using a similar technique for auto-detection as is being done in postgres). I added a bit of extra version format processing since oracle version numbers come in both the major.minor format as well as an edition format (such as 9i).

Additional unit and integration tests have been added for the new auto-version-detection features as well as the name max length resolution. I have also updated existing integration and unit tests that relied on the hashed names to expect the standard format since the test oracle database is using version 18.

For older oracle versions, the old hashed name method is still used.

One aspect of this change that may or may not need additional consideration is in the scenario that someone using an older knex version, prior to this change, on oracle 12.2 or greater upgrades to the newest version of knex after this feature is released. Knex will no longer try to convert to the hashed name format when performing schema operations. This would be problematic when a "legacy-named" object is altered or deleted in a migration after upgrading. One potential work-around is to set the version manually to 12.1 in the knex configuration. The other option is providing a means for renaming the old format to the new format. This may make this a breaking change as it may require configuration changes in some use cases.

When running the oracle integration tests, I had several failing, even on master before any of these changes. I have gone through to make sure that all tests that were failing after these changes were the same that were failing before. Unit test results appear to be completing without issue before and after changes.

Closes #3914

@Kytech Kytech changed the title Oracle char limit upstream pr Support Object Names Greater than 30 Characters for Oracle DB Versions 12.2 and Greater May 26, 2022
const versionParts = oracleVersion
.split('.')
.map((versionPart) => parseInt(versionPart));
if (
Copy link
Collaborator

Choose a reason for hiding this comment

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

comment explaining the difference would be helpful

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me know if the comment I added is in line with what you were thinking @kibertoad

@Kytech Kytech requested a review from kibertoad May 27, 2022 17:58
@coveralls
Copy link

coveralls commented May 28, 2022

Coverage Status

coverage: 92.814% (-0.004%) from 92.818% when pulling 0dd7718 on ITDeptUtahCountyGovernment:oracle-char-limit-upstream-pr into 3ba9550 on knex:master.

Request from upstream maintainers.
@Kytech Kytech requested a review from OlivierCavadenti May 31, 2022 04:51
@Kytech
Copy link
Contributor Author

Kytech commented Sep 28, 2022

Just corrected the lint error in the test file I created. Will keep an eye on this for any further feedback since I recently altered the version detection method used in this PR.

@erwan-becquet
Copy link

Hi there, any idea when this will be included in knex ? thanks in advance.

@Kytech
Copy link
Contributor Author

Kytech commented Apr 15, 2023

Hi there, any idea when this will be included in knex ? thanks in advance.

I just resolved the merge conflict, but if there are any issues with tests after the merge, I'll have to address those once I am able to finish the current project that demands most of my time at the moment, but other than that, I've addressed all the current feedback from the maintainers, so it depends on when they will take another look at this PR once all tests passing now that I've resolved the merge conflict.

@Kytech
Copy link
Contributor Author

Kytech commented Apr 15, 2023

@OlivierCavadenti and @kibertoad I've resolved the merge conflict and it looks like the checks that are failing are the same as those on the current master branch as of when I resolved the merge conflict. Let me know if anything further needs to be done to push this over the finish line.

@baileymatthewr
Copy link
Contributor

@Kytech: Perhaps we can get this reviewed again.

@Kytech
Copy link
Contributor Author

Kytech commented Jul 19, 2023

@Kytech: Perhaps we can get this reviewed again.

Looks like the maintainers saw your comment, so I take it that they are aware of the current state of this PR. Just waiting to see if any further changes are needed.

@kibertoad
Copy link
Collaborator

@Kytech I'm OK to land the change after conflicts are resolved

@Kytech
Copy link
Contributor Author

Kytech commented Oct 12, 2023

@Kytech I'm OK to land the change after conflicts are resolved

Great! I'll get conflicts resolved within the next hour.

@Kytech
Copy link
Contributor Author

Kytech commented Oct 12, 2023

@kibertoad merge conflicts have been resolved. Looks like the CI failures are the same ones as on the master branch - I didn't spot anything new. Let me know if you need me to do anything else to get this wrapped up.

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.

Limit is hard coded when it has changed since oracle 12.2

8 participants