jennifer v0.11.1 Release Notes

Release Date: 2021-08-24 // 2 months ago
  • General

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

    Migration

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

Previous changes from v0.11.0

  • General

    • โž• add crystal >= 1.0.0 support
    • ๐Ÿ›  fix inconsistent method signatures in multiple places
    • โž• add #to_json to the following structs: PG::Numeric, PG::Geo::Point, PG::Geo::Line, PG::Geo::Circle, PG::Geo::LineSegment, PG::Geo::Box, PG::Geo::Path, PG::Geo::Polygon, Char, Time::Span, Slice, UUID
    • โž• add crystal-mysql: 0.13.0 support
    • โž• add crystal-pg: 0.23.2 support

    QueryBuilder

    • โž• add custom #to_json to serialize retrieved collection
    • โž• add #where accepting Hash(Symbol, _)
    • โž• add Criteria#equal and Criteria#not_equal as original implementation of Criteria#== and Criteria#!=
    • โž• add ExpressionBuilder #and, #or and #xor methods that accepts array of conditions

    Model

    • Authentication#password returns given unecrypted value
    • โž• add Coercer module with static methods to localize all coercing logic for different types
    • โž• add .coercer method to return object responding to all coercing methods described in Coercer
    • mapping generates .coerce_{{attribute}(value : String) methods for every field to coerce string value to attribute's type
    • mapping generates for every non-string attribute with a setter additional #{{attribute}}=(value : String) setter
    • ๐Ÿ‘ allow all build methods (.new, .create and .update) to receive Hash(String, String) and coerce values to expected types
    • โž• add .column_name to return all field names
    • ๐Ÿ›  fix .field_names from returning child's properties for parent class
    • โž• add custom #to_json
    • change converter interface to .from_db(DB::ResultSet, NamedTuple), .from_db(DB::ResultSet, NamedTuple) and .from_hash(Hash, String | Symbol, NamedTuple)
    • ๐Ÿ”„ change all existing converters to support new required interface
    • โž• add BigDecimalConverter(T) converter
    • โž• add Coercer.coerce(String, (BigDecimal?).class)
    • add time_zone_aware option for TimeZoneConverter to specify whether field should respect time zone converting logic
    • โž• add support of date only and time only string formats for TimeZoneConverter
    • add time_format, date_time_format and date_format to customize time, date time and date formats respectively
    • ๐Ÿ›  fix a bug where updated_at is not set in the generated sql query from model.save
    • NumericToFloat64Converter, BigDecimalConverter, TimeZoneConverter #from_hash accepts string as field value
    • BigDecimalConverter#from_hash accepts integer and float values as field value
    • ๐Ÿ›  fix Errors#inspect bug using old UInt64#to_s signature
    • introduce Timestamp module that now includes with_timestamps macro
    • reworked how updated_at and created_at fields are set before save - now they are set explicitly without utilizing callbacks
    • โž• add Resource.where accepting Hash(Symbol, _)

    Validation

    • ๐Ÿ”„ change Validator#validate abstract interface to #validate(record, **opts)
    • โšก๏ธ update all built-in validators to reflect new Validator interface
    • make Validator.with_blank_validation macro to accept arguments to reference record, field name, value and blank value acceptance

    Relation

    • remove abstract #condition_clause & #condition_clause(a) declarations from IRelation

    View

    • โž• add custom #to_json

    Adapter

    • โœ‚ remove abstract #update declaration from Base
    • BaseSQLGenerator#parse_query converts Time arguments to UTC only if Config.time_zone_aware_attributes set to true
    • Mysql#read_column calls super if column isn't a tiny int
    • ResultParser#read_column convert time to Config.local_time_zone if Config.time_zone_aware_attributes set to true or just change time zone to it otherwise

    Config

    • .reset_config creates new instance instead of executing #initialize on existing object
    • add Config.time_zone_aware_attributes to specify whether time zone converting logic should be globally disabled

    Migration

    • โž• add precision and scale options support for decimal data type

    Record

    • โž• add custom #to_json
    • โž• add custom #inspect