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

feat: Omit Columns from SQL statements (e.g uuid columns) #802

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

Commits on Oct 18, 2023

  1. feat: Omit Columns from SQL statements (e.g uuid columns)

    I've added two options for omitting columns from the SQL statements, to avoid having to modify class level `self.ignored_columns` since we've had issues with this affecting other code that runs at the same time. These options work as follows:
    
    `Model.import(values, omit_columns: [:guid])` # Omit the guid column from SQL statement, allowing it to generate
    `Model.import(values, omit_columns: -> (model, column_name) { [:guid] if model == Model })` Allow per-model decisions, e.g for recursive imports
    `Model.import(values, omit_columns: { Model => [:guid] })` Use a hash instead of a proc
    
    The second option is `:omit_columns_with_default_functions` boolean, to automatically find columns that have a default function declared in the schema, and omit them by default.
    
    fix: Require AR 5.0+
    Amnesthesia committed Oct 18, 2023
    Configuration menu
    Copy the full SHA
    06b0f32 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b19a2ed View commit details
    Browse the repository at this point in the history