jennifer v0.7.0 Release Notes

Release Date: 2019-01-08 // over 5 years ago
  • Overview

    ๐Ÿš€ This release was hard and pretty long. As a result we've got a set of very important features (like polymorphic relations and complex query update mechanism). Also as a side effect bunch of side-shards were appeared to fill gaps in missing functionality (like form parsing).

    ๐ŸŒ Also you can find 3 sample application describing possible way of integrating web frameworks/libraries with Jennifer:

    ๐Ÿ”„ Changelog

    General

    • โฌ†๏ธ bump sam to "~> 0.3.0"
    • โž• add sam command generate:model to generate model and related migration
    • ๐Ÿšš move all logic regarding file generating to Jennifer::Generators space
    • โž• add db:seed task as a placeholder seeding task
    • ๐Ÿ‘€ db:setup now invokes db:seed after db:migrate

    QueryBuilder

    • โž• add #and, #or and #xor shortcut methods to ExpressionBuilder
    • Criteria#in now accepts SQLNode as well
    • โž• add Statement module with base abstract functionality needed for query string generating
    • ExpressionBuilder#g and #group now has no argument type restriction
    • Grouping#condition now can be of Statement type
    • Query includes Statement
    • Query#to_sql now is #as_sql, #select_args - #sql_args
    • Condition includes Statement
    • โšก๏ธ Executables#update accepts block expecting Hash(Symbol, Statement) to be returned
    • โšก๏ธ Executables#modify is removed in favor of new #update method accepting block
    • now LogicOperator is inherited from SQLNode
    • #delete and exists? of Executables do nothing when #do_nothing? is true
    • โž• add Query#do_nothing?
    • โž• add Query.null which returns Query.new.none
    • Join accepts Grouping for ON condition

    Model

    • remove Base.build_params, Base.parameter_converter methods
    • โœ‚ remove ParameterConverter class
    • ๐Ÿ›  fix skipping generating default constructor byMapping.mapping when at least one field has default value and all others are nilable
    • ๐Ÿšš stringified_type option is removed from the COLUMNS_METADATA
    • STIMapping#arguments_to_save & STIMapping#arguments_to_insert now respect field converter
    • ๐ŸŒ Translation model now is includeable module
    • ๐ŸŒ all class methods of Translation are moved to Translation::ClassMethods which is automatically extended by target class using included macro
    • #lookup_ancestors and #human_attribute_name methods of Translation are added
    • ๐ŸŒ Errors#base now is type of Translation instead of Base
    • โž• add Base#persisted?
    • now attribute-specific rendering for Resource#inspect is generated by .mapping
    • add polymorphic relation support for has_one, has_many and belongs_to relations
    • โž• add :nodoc: for almost all generated relation methods (except #association)
    • โž• add missing relation names for criterion in Relation::Base methods
    • โž• add Relation::IPolymorphicBelongsTo, Relation::PolymorphicHasMany and Relation::PolymorphicHasOne
    • @new_record, @destroyed, @errors, changeset and relation attributes now is ignored by JSON::Serializable
    • add skip_validation argument to Authentication.with_authentication macro to specify whether validation should be added
    • โž• add generating predicate method #{{attribute}}? for boolean attribute
    • ๐Ÿ‘ allow Jennifer::Model::Base#attribute= to accept not only defined type but also Jennifer::DBAny
    • rename Base#update_attributes to Base#set_attributes

    Validation

    • all validation macros now accept :if key; the value may be both Symbol name of a method to be called or expression
    • replace validation logic generated during a macro call with new validators usage: Validations::Absence, Validations::Acceptance, Validations::Confirmation, Validations::Exclusion, Validations::Format, Validations::Inclusion, Validations::Length, Validations::Numericality, Validations::Presence, Validations::Uniqueness
    • โœ‚ remove Jennifer::Validator in favour of Jennifer::Valdiations::Validator
    • 0๏ธโƒฃ all validators by default implement singleton pattern
    • ๐Ÿšš all validation macros are moved to Jennifer::Validations::Macros

    View

    • now attribute-specific rendering for Resource#inspect is generated by .mapping
    • โž• add generating predicate method #{{attribute}}? for boolean attribute

    Adapter

    • ๐Ÿ›  fix output stream for postgres schema dump
    • โœ‚ remove legacy postgres insert
    • add Adapter#foreign_key_exists?
    • โž• add Mysql::SchameProcessor
    • now Base#schema_processor is abstract
    • โž• add Postgres::SchemaProcessor#rename_table
    • SchemaProcessor now is abstract class
    • ๐Ÿ— all builder methods are moved from SchemaProcessor class to TableBuilderBuilders module
    • fix syntax in SchemaProcessor#drop_foreign_key
    • all _query arguments in Base methods are renamed to query
    • ๐Ÿšš Base.extract_arguments is removed
    • .delete, .exists and .count of BaseSQLGenerator now returns string
    • ๐Ÿšš Postgres.bulk_insert is removed
    • ๐Ÿš€ Transaction#with_connection ensure to release connection
    • ๐Ÿšš all sqlite3 related code are removed

    Config

    • fix migration_failure_handler_method property from being global
    • add new property model_files_path representing model directory (is used in a scope of model generating)
    • fix ignoring skip_dumping_schema_sql config

    SqlGenerator

    • .select_clause now doesn't invoke .from_clause under the hood
    • ๐Ÿ”’ .lock_clause adds whitespaces around lock statement automatically

    Migration

    • remove Runner.generate and Runner::MIGRATION_DATE_FORMAT
    • TableBuilder::CreateTable#reference triggers #foreign_key and accepts polymorphic bool argument presenting whether additional type column should be added; for polymorphic reference foreign key isn't added

    Exceptions

    • ๐Ÿ“œ 'RecordNotFound' from QueryBuilder::Query#first! and QueryBuilder::Query#last! includes detailed parsed query