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

Cache column option #654

Merged
merged 7 commits into from
Mar 26, 2023
Merged

Cache column option #654

merged 7 commits into from
Mar 26, 2023

Commits on Mar 26, 2023

  1. Merge :depth_cache_column and :cache_depth options

    The boolean flag was redundant for the column
    Have kept the previous option available, but included a deprecation message
    
    
    has_ancestry :cache_depth => "ancestry_depth2"
    has_ancestry :cache_depth => true # "ancestry_depth2"
    
    deprecated:
    
    has_ancestry :cache_depth => true, :depth_cache_column => "ancestry_depth2"
    kbrock committed Mar 26, 2023
    Configuration menu
    Copy the full SHA
    304fb8f View commit details
    Browse the repository at this point in the history
  2. Don't define scopes on models that do not implement depth caching

    a. don't define dynamic methods that will just raise an exception.
    b. simpler to just define the scopes by hand than with a loop
    kbrock committed Mar 26, 2023
    Configuration menu
    Copy the full SHA
    de55f99 View commit details
    Browse the repository at this point in the history
  3. Implement depth as a subquery

    The main reason I introduced depth sql is to improve rebuild_depth_cache_sql!
    Throwing this into the scopes is a bonus. (but not really)
    
    This works great for the update, but the extra scopes will not perform well.
    If you need to use them, consider adding an index on that equation
    kbrock committed Mar 26, 2023
    Configuration menu
    Copy the full SHA
    ed20bfa View commit details
    Browse the repository at this point in the history
  4. Changelog comments

    kbrock committed Mar 26, 2023
    Configuration menu
    Copy the full SHA
    0000a3c View commit details
    Browse the repository at this point in the history
  5. update depth_cache_column using math

    Use math to adjust the depth_cache instead of re-calculating the depth
    
    I had wanted to use ancestry_depth_sql, but that was using the ancestry value
    and putting in the new ancestry value would have been too complicated
    
    goal: remove the regular expression
    kbrock committed Mar 26, 2023
    Configuration menu
    Copy the full SHA
    fe20579 View commit details
    Browse the repository at this point in the history
  6. drop ancestry_format class accessor

    In our code, if the functionality depends upon the ancestry format,
    we need to move that into the format modules
    kbrock committed Mar 26, 2023
    Configuration menu
    Copy the full SHA
    54dcb36 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    963c1ea View commit details
    Browse the repository at this point in the history