Skip to content

Rework changes detection; Implement tests for renames #188

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

KES777
Copy link
Contributor

@KES777 KES777 commented Apr 5, 2025

In this PR we:

  • Add more tests for renames workflows.
  • Simplify code to detect renames.
    Now function could be easily reused for different types of objects
  • Document code
  • Fix the issue when field is created before renames happened.
    This happens when we want to drop the old object and give the name of dropped object to another one.

This changes are related to #184

Eugen Konkov added 3 commits April 3, 2025 22:44
When object has 'renamed_from' property, but the previous version does not exists, the
warning should be issued and for this object CREATE XXX query should be generated.
Fixes: 185

GitHub: dbsrgits#185
@KES777 KES777 force-pushed the implement_tests_for_renames branch from 0575de1 to 9ddf601 Compare April 5, 2025 03:16
@KES777
Copy link
Contributor Author

KES777 commented Apr 6, 2025

Also fixes this: jjn1056/DBIx-Class-Migration#129

Eugen Konkov added 5 commits May 4, 2025 17:03
Renames should go first, otherwise it could not be possible to add a new column with
the name which was just renamed to something. Eg. SRC:x->DST:y, Create DST:x.
Otherwise we can not run 'Create DST:x', because schema still have 'x' column.
@KES777 KES777 force-pushed the implement_tests_for_renames branch from f9e50ba to fd58e13 Compare May 4, 2025 21:03
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.

apologies on the slow turnaround; out of perl now and just started a new $job, but i'll see if i can squeeze this in.
Trying to understand the full intent + then i can dig into more

Copy link
Contributor

Choose a reason for hiding this comment

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

the tests here have nothing to do with the rest of the producer behaviors, could you just put this in a new diff test which produces yaml?

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'll do that.

# alter ( $src_version, $dst_version )
# create( $dst_version )
# drop ( $src_version )
# next ( $dst_name, $dst_version )
Copy link
Contributor

Choose a reason for hiding this comment

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

i'm not understanding what the next callback is meant to do; would you mind expounding on that?

Copy link
Contributor Author

@KES777 KES777 Jun 7, 2025

Choose a reason for hiding this comment

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

next call back is fired for every dst column. This is to run some code for each dst name/column/table.

At the moment this call back is used to prepare/initialize required data structures which will be filled/used later.
image

I agree that the name is not the best. Probably it could be better if we name it every or init. Just suggest better name you like and I'll change it.

@KES777
Copy link
Contributor Author

KES777 commented Jun 8, 2025

Intention in this PR is to fix bugs, generalize code and extend tests.

@KES777 KES777 requested a review from rabbiveesh June 8, 2025 19:07
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.

2 participants