propelorm / Propel2

Propel2 is an open-source high-performance Object-Relational Mapping (ORM) for modern PHP
http://propelorm.org/
MIT License
1.26k stars 399 forks source link

Manage foreign keys on archivable behavior #1935

Closed mringler closed 1 year ago

mringler commented 1 year ago

Allows better management of foreign keys in archivable behavior.

Basically implements #1484 with tests, where FKs can be copied from the source table to an automatically generated archive table. Also, it adds the possibility to declare new FKs as part of the behavior declaration. Finally, it adds a parameter sync, which, if enabled, copies columns, indexes and optionally fks to an archive table that is not automatically generated, allowing for flexible overriding of archive table properties.

I have added documentation for these options along with the different use cases they cover at propelorm/propelorm.github.com#433

codecov-commenter commented 1 year ago

Codecov Report

Base: 73.25% // Head: 88.30% // Increases project coverage by +15.05% :tada:

Coverage data is based on head (09473c8) compared to base (b542279). Patch coverage: 95.09% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1935 +/- ## ============================================= + Coverage 73.25% 88.30% +15.05% - Complexity 7917 7969 +52 ============================================= Files 227 242 +15 Lines 21133 24256 +3123 ============================================= + Hits 15480 21420 +5940 + Misses 5653 2836 -2817 ``` | Flag | Coverage Δ | | |---|---|---| | 5-max | `88.30% <95.09%> (+15.05%)` | :arrow_up: | | 7.4 | `88.30% <95.09%> (+15.05%)` | :arrow_up: | | agnostic | `67.65% <95.09%> (?)` | | | mysql | `68.86% <11.76%> (-0.09%)` | :arrow_down: | | pgsql | `68.86% <11.76%> (-0.19%)` | :arrow_down: | | sqlite | `66.82% <11.76%> (-0.14%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=propelorm#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://codecov.io/gh/propelorm/Propel2/pull/1935?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=propelorm) | Coverage Δ | | |---|---|---| | [...nerator/Behavior/Archivable/ArchivableBehavior.php](https://codecov.io/gh/propelorm/Propel2/pull/1935/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=propelorm#diff-c3JjL1Byb3BlbC9HZW5lcmF0b3IvQmVoYXZpb3IvQXJjaGl2YWJsZS9BcmNoaXZhYmxlQmVoYXZpb3IucGhw) | `93.89% <94.04%> (+93.89%)` | :arrow_up: | | [src/Propel/Generator/Model/Behavior.php](https://codecov.io/gh/propelorm/Propel2/pull/1935/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=propelorm#diff-c3JjL1Byb3BlbC9HZW5lcmF0b3IvTW9kZWwvQmVoYXZpb3IucGhw) | `86.02% <100.00%> (-0.19%)` | :arrow_down: | | [src/Propel/Generator/Model/Index.php](https://codecov.io/gh/propelorm/Propel2/pull/1935/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=propelorm#diff-c3JjL1Byb3BlbC9HZW5lcmF0b3IvTW9kZWwvSW5kZXgucGhw) | `97.84% <100.00%> (+14.33%)` | :arrow_up: | | [src/Propel/Generator/Model/Table.php](https://codecov.io/gh/propelorm/Propel2/pull/1935/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=propelorm#diff-c3JjL1Byb3BlbC9HZW5lcmF0b3IvTW9kZWwvVGFibGUucGhw) | `90.54% <100.00%> (+17.06%)` | :arrow_up: | | [src/Propel/Generator/Builder/Om/ClassTools.php](https://codecov.io/gh/propelorm/Propel2/pull/1935/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=propelorm#diff-c3JjL1Byb3BlbC9HZW5lcmF0b3IvQnVpbGRlci9PbS9DbGFzc1Rvb2xzLnBocA==) | `45.94% <0.00%> (-16.56%)` | :arrow_down: | | [...el/Generator/Builder/Om/ExtensionObjectBuilder.php](https://codecov.io/gh/propelorm/Propel2/pull/1935/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=propelorm#diff-c3JjL1Byb3BlbC9HZW5lcmF0b3IvQnVpbGRlci9PbS9FeHRlbnNpb25PYmplY3RCdWlsZGVyLnBocA==) | `81.48% <0.00%> (-7.41%)` | :arrow_down: | | [src/Propel/Generator/Model/BehaviorableTrait.php](https://codecov.io/gh/propelorm/Propel2/pull/1935/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=propelorm#diff-c3JjL1Byb3BlbC9HZW5lcmF0b3IvTW9kZWwvQmVoYXZpb3JhYmxlVHJhaXQucGhw) | `76.92% <0.00%> (-5.94%)` | :arrow_down: | | [...or/Builder/Om/ExtensionQueryInheritanceBuilder.php](https://codecov.io/gh/propelorm/Propel2/pull/1935/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=propelorm#diff-c3JjL1Byb3BlbC9HZW5lcmF0b3IvQnVpbGRlci9PbS9FeHRlbnNpb25RdWVyeUluaGVyaXRhbmNlQnVpbGRlci5waHA=) | `83.33% <0.00%> (-5.13%)` | :arrow_down: | | [...l/Generator/Behavior/Validate/ValidateBehavior.php](https://codecov.io/gh/propelorm/Propel2/pull/1935/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=propelorm#diff-c3JjL1Byb3BlbC9HZW5lcmF0b3IvQmVoYXZpb3IvVmFsaWRhdGUvVmFsaWRhdGVCZWhhdmlvci5waHA=) | `91.80% <0.00%> (-4.12%)` | :arrow_down: | | [.../Propel/Generator/Command/Helper/ConsoleHelper.php](https://codecov.io/gh/propelorm/Propel2/pull/1935/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=propelorm#diff-c3JjL1Byb3BlbC9HZW5lcmF0b3IvQ29tbWFuZC9IZWxwZXIvQ29uc29sZUhlbHBlci5waHA=) | `80.76% <0.00%> (-4.02%)` | :arrow_down: | | ... and [190 more](https://codecov.io/gh/propelorm/Propel2/pull/1935/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=propelorm) | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=propelorm). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=propelorm)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

mringler commented 1 year ago

@dereuromark Thank you for merging. Documentation is at https://github.com/propelorm/propelorm.github.com/pull/433