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

Oracle producer add missing functions #143

Merged
merged 19 commits into from
Feb 23, 2023

Conversation

hazardv
Copy link
Contributor

@hazardv hazardv commented Aug 19, 2022

Adds functionality to Producer/Oracle.pm to:

  • Alter create constraints
  • Alter drop constraints
  • Drop fields
  • Drop tables
  • Alter create index
  • Alter drop index

Related tests have been added to prove changes and all existing tests pass.
Automatic creation of trigger to insert sysdate to all timestamp fields has been commented out. That should not be done automatically.

Changes were modeled after the structure of Producer/MySQL.pm.

This branch also includes changes from pull request #142

@hazardv hazardv changed the title Oracle add alter constraint Oracle producer add alter constraint and other missing functions Aug 25, 2022
@hazardv hazardv changed the title Oracle producer add alter constraint and other missing functions Oracle producer add missing functions Aug 25, 2022
lib/SQL/Translator/Producer/Oracle.pm Outdated Show resolved Hide resolved
lib/SQL/Translator/Producer/Oracle.pm Outdated Show resolved Hide resolved
t/54-oracle-sql-diff.t Outdated Show resolved Hide resolved
@hazardv
Copy link
Contributor Author

hazardv commented Sep 9, 2022

@mohawk2 The code you reviewed was from a few commits back. This is the first time I am attempting to contribute to a project like this so I am betting that I messed a few things up.

I have been using DBIx::Class and DBIx::Class::Schema::Versioned for another project and while working on that I discovered functionality that was missing from the Oracle producer. I added in the missing functionality and submitted the pull request. I continued with my project, made changes to the data model, attempted to generate the DDL, and discovered a few more things missing from the Oracle producer. So I added those things into the same branch because it seemed reasonable and pushed the changes. I did that whole process one more time and now I am like 97% sure that all of the missing functionality has been implemented and I won't make any more changes to the branch.

Please check out the latest commit b14da74 and let me know if you see any issues.

@mohawk2
Copy link
Contributor

mohawk2 commented Sep 26, 2022

Thanks for the updates.

The current list of commits sort of meanders, which isn't a criticism, but does highlight a possible process-improvement, especially to help reviewers. Since this is on a branch belonging to you, it's safe to force-push it. The way I work is to end up with the branch I'm making having a series of small commits, each of which meaningfully transforms the starting code towards the desired end-state. This often involves squashing together (using rebase "fixup" command) previous versions of a change, with a correction. This means the final list of commits doesn't have things like commented code, then removal of that (as here). Having adjusted the list of commits to a new one, you'd then need to force-push it.

The alternative (which isn't fatal) is that this set of commits will either (if merged in as-is) be slightly untidy for future people looking to see why a piece of code is as it is, or (if squash-merged) a single quite large commit which can take longer to comprehend.

Tagging in @rabbiveesh.

@mohawk2 mohawk2 requested review from rabbiveesh and removed request for mohawk2 September 26, 2022 00:05
@hazardv
Copy link
Contributor Author

hazardv commented Sep 26, 2022

@mohawk2 Thank you for the pointers. I will try to clean up my commits to be more concise in the future. I found one last issue with altering constraints for Oracle while working on my personal project (dropping an unnamed primary key constraint) and have pushed the change to this branch. At this point, I have personally tested all of the constraint alteration functionality in my other project (as well as adding tests for this project) and am confident in them.

Copy link
Contributor

@rabbiveesh rabbiveesh left a comment

Choose a reason for hiding this comment

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

Hey, I only ran through a little bit, but then I saw that tests are failing on my box.
I suggest you make sure that all tests pass.

Here's the list of failing files:
t/54-oracle-sql-diff.t
t/30sqlt-new-diff-mysql.t
t/30sqlt-new-diff-pgsql.t
t/30sqlt-new-diff-sqlite.t
t/51-xml-to-oracle.t
t/51-xml-to-oracle_quoted.t

lib/SQL/Translator/Diff.pm Outdated Show resolved Hide resolved
lib/SQL/Translator/Parser/Oracle.pm Show resolved Hide resolved
@hazardv
Copy link
Contributor Author

hazardv commented Sep 29, 2022

@rabbiveesh after reverting the change in Diff.pm (and fixing one of my test plans) all of the tests are passing on my box except for t/60roundtrip.t. It is looking for t/data/roundtrip_autogen.yaml which I am unable to locate in my branch or in the current project master.

@rabbiveesh
Copy link
Contributor

rabbiveesh commented Oct 1, 2022

Yeah, to get the roundtrip test working you need some script. You can run Makefile.PL, and then run make test(you only need to run Makefile.PL), it should initialize whatever you need.

@hazardv
Copy link
Contributor Author

hazardv commented Oct 5, 2022

@rabbiveesh Sorry about that, I did not realize I had introduced an issue. With the latest commit (74c0312) the tests all pass on my box (including roundtrip).

Copy link
Contributor

@rabbiveesh rabbiveesh left a comment

Choose a reason for hiding this comment

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

could you just remove the debug statements from the Oracle producer?

I mean, unless you think we should keep them?

@hazardv
Copy link
Contributor Author

hazardv commented Oct 10, 2022

@rabbiveesh I added them following how they were used in the MySQL producer, tagged them with "ORA" at the start, and included them sparingly figuring they could be useful for someone debugging their code in the future. Since they only generate output if the user specifies $DEBUG = 1 I didn't think they hurt anything to be there but if you want them removed I will remove them.

Copy link
Contributor

@rabbiveesh rabbiveesh left a comment

Choose a reason for hiding this comment

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

K, wasnt sure if you had missed some in the last commit.
@mohawk2 any thoughts?

@hazardv hazardv requested a review from mohawk2 October 31, 2022 15:25
@hazardv
Copy link
Contributor Author

hazardv commented Dec 1, 2022

Hey @mohawk2, can you please take a look at this when you get a minute?

@hazardv
Copy link
Contributor Author

hazardv commented Jan 6, 2023

@mohawk2 Happy New Year!!!

Copy link
Contributor

@mohawk2 mohawk2 left a comment

Choose a reason for hiding this comment

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

I'm a bit surprised by the tests being removed from the XML-related tests. If @rabbiveesh is content it's for a good reason then so am I. Otherwise, all looks fine.

@hazardv
Copy link
Contributor Author

hazardv commented Feb 16, 2023

I'm a bit surprised by the tests being removed from the XML-related tests. If @rabbiveesh is content it's for a good reason then so am I. Otherwise, all looks fine.

@mohawk2 The only things I removed from the XML tests were the checks looking for the triggers that previously got created for all timestamp fields. Since there is no reason to create that trigger for all timestamp fields I commented out the code in commit ab42ef8. I then removed the commented-out code in commit b14da74.

@rabbiveesh
Copy link
Contributor

sorry for the delay on this; we're good to go

@rabbiveesh rabbiveesh merged commit 5af7273 into dbsrgits:master Feb 23, 2023
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.

None yet

3 participants