jennifer v0.12.0 Release Notes

Release Date: 2021-12-15 // over 2 years ago
  • General

    • โž• add crystal 1.2.0 support

    QueryBuilder

    • #pluck accepts splatted named tuple of desired attribute-type pairs and returns array of such tuples as a records
    • ๐Ÿ— #upsert passes expression builder as a block argument

    Model

    • add Optimistic locking support via macro with_optimistic_lock(column_name = lock_version)
    • updated_at and created_at fields aren't override on save if have been set manually
    • โž• add upsert class method to insert multiple models while ignoring conflicts on specified unique fields

    Adapter

    • ๐Ÿ›  fix database connection query arguments building
    • each adapter includes RequestMethods instead of including it by base adapter class
    • โž• add a new upsert overload that allows passing a collection of Jennifer::Model::Base
    • fix insert_on_duplicates sql generation for postgres adapter if no unique fields given

    SqlGenerator

    • โšก๏ธ any INSERT, UPDATE, SELECT and DELETE requests uses quoted tables/columns if they are created by QueryBuilder::ExpressionBuilder (raw SQL is placed as-is)
    • .select_clause uses specified query attributes to select and fall back to custom fields only if there is no custom attribute to select

    Migration

    • TableBuilder::ChangeTable now performs DropForeignKey, DropIndex & DropReference before any column manipulation
    • ๐Ÿ›  fix TableBuilder::ChangeEnum to use specified adapter to query effected tables

Previous changes from v0.11.1

  • General

    • switch to the crimson-knight/i18n.cr ~> 0.4.1

    Migration

    • ๐Ÿ›  fix TableBuilder::ChangeTable#drop_reference dropping column before reference
    • โž• add TableBuilder::DropReference