All Versions
17
Latest Version
Avg Release Cycle
63 days
Latest Release
121 days ago

Changelog History
Page 1

  • v0.9.0

    May 24, 2020

    ๐Ÿ”„ Changelog

    General

    • โž• add Crystal 0.34.0 support
    • add Jennifer::Presentable with abstract methods declarations (#attribute, #errors, #human_attribute_name, #attribute_metadata, #class_name)

    QueryBuilder

    • Query#initialize now accept Adapter::Base as a second (optional) argument
    • OrderItem is renamed to OrderExpression to avoid possible name collisions

    Model

    • fix an issue with rendering new_record and destroyed system variables by #to_json
    • 0๏ธโƒฃ Resource.table_prefix now returns underscored namespace name (if any) by default
    • Base includes Jennifer::Presentable
    • โž• add Translation#class_name method to return underscored class name
    • โž• add Mapping#attribute_metadata to return attribute metadata by it's name
    • remove Base::primary_field_type
    • Prevent compile time error with models named Model or Record

    View

    • fix an issue with rendering new_record and destroyed system variables by #to_json
    • remove Base::primary_field_type

    Adapter

    • db connection is established on the first request no on adapter initialization
    • ๐Ÿ‘€ Adapter.adapter_class raises BaseException if no valid Config.adapter is specified
    • .command_interface, .create_database, .drop_database, .generate_schema, .load_schema, .db_connection, .connection_string, .database_exists? now are instance methods
    • Base#initialize now excepts Config instance
    • respect host in Jennifer::Postgres::CommandInterface#database_exists?
    • escape connection URI segments
    • ๐ŸŒฒ Config#logger now is Log instead of Logger
    • โž• add read/write adapter segregation
    • ๐Ÿ—„ deprecate .adapter & .adapter_class
    • โœ‚ remove .query, .exec & .scalar

    Config

    • .reset_config invokes #initialize instead of creating new instance

    Migration

    • Base#schema_processor is no more public api
    • Runner.create and Runner.drop now accept option Adapter::Base instance
    • pass to_table in TableBuilder::DropForeignKey#process
    • ๐Ÿ›  fix TableBuilder::CreateTable#reference - now it takes into account given SQL type for the foreign key column
    • add #add_reference, #drop_reference, #add_timestamps to TableBuilder::CHangeTable
    • TableBuilder::CHangeTable#drop_index also accepts single column name
    • โœ‚ remove deprecated TableBuilder::CreateTable#index overrides

    Record

    • ๐Ÿšš #initialize(DB::ResultSet) is removed
  • v0.8.4

    November 15, 2019

    ๐Ÿ”„ Changes

    QueryBuilder

    • ๐Ÿ‘‰ use adapter's #read_column in NestedRelationTree
    • โž• add RelationTree#adapter
    • ๐Ÿ›  fix Ordering#order(Hash(String | Symbol, String | Symbol))

    Adapter

    • ๐Ÿ›  fix issue with treating tinyint mysql field as boolean
    • remove ResultParser#result_to_array
    • โž• add Mysql#read_column
    • add Base.default_max_bind_vars_count which returns default maximum count of bind variables that can be used in Base#bulk_insert (default is 32766)
    • Mysql.default_max_bind_vars_count and Postgres.default_max_bind_vars_count returns 32766
    • ๐Ÿ”’ Base#bulk_insert doesn't do table lock no more
    • if variables that should be inserted by Base#bulk_insert exceed Base.max_bind_vars all of them are quoted and put into a query
    • โœ‚ remove BaseSQLGenerator::ARRAY_ESCAPE
    • move BaseSQLGenerator::ARGUMENT_ESCAPE_STRING to Quoting
    • move BaseSQLGenerator .quote, .escape_string, .filter_out to Quoting
    • โž• add correct values quoting for postgres adapter
    • โž• add correct values quoting for mysql adapter
    • โช now logger writes BEGIN instead of TRANSACTION START, COMMIT instead of TRANSACTION COMMIT and ROLLBACK instead of TRANSACTION ROLLBACK on corresponding transaction commands
    • โœ‚ add SchemaProcessor::FkEventActions enum to validate on_delete and on_update action values; String | Symbol still should be used as an argument type everywhere

    Config

    • add max_bind_vars_count property to present maximum allowed count of bind variables to be used in bulk insert operation
    • add MigrationFailureHandler enum to validate migration_failure_handler_method value; Symbol | MigrationFailureHandler should be used as an argument for it
    • fix migration_failure_handler_method config - make it instance property
  • v0.8.3

    October 19, 2019

    ๐Ÿ”„ Changes

    General

    • โž• add crystal 0.31.1 compatibility
    • โž• add crystal-db@0.7.0 support
    • โœ‚ remove sam from mandatory dependencies

    Model

    • ๐Ÿ›  fix bug with primary field presence assertion

    View

    • ๐Ÿ›  fix bug with primary field presence assertion

    Adapter

    • โž• add date SQL data type
    • date_time field type maps to timestamp SQL data type (postgres only)

    Migration

    • โž• add Runner.pending_migration? to return whether there is pending (not invoked) migration
    • โž• add Base.with_transaction method to disable automatic transaction wrapping around migration methods
    • โž• add Base.with_transaction? to check whether migration is run under a transaction
    • โœ‚ remove var_string field type
    • โœ‚ remove blob field type for postgres
    • ๐Ÿ›  fix wrong explanation message for TableBuilder::CreateIndex
    • โž• add new TableBuilder::CreateTable#index signatures (old ones are deprecated):
      • #index(fields : Array(Symbol), type : Symbol | ::Nil = nil, name : String | ::Nil = nil, lengths : Hash(Symbol, Int32) = {} of Symbol => Int32, orders : Hash(Symbol, Symbol) = {} of Symbol => Symbol)
      • #index(field : Symbol, type : Symbol | ::Nil = nil, name : String | ::Nil = nil, length : Int32 | ::Nil = nil, order : Symbol | ::Nil = nil)
    • 0๏ธโƒฃ make default varchar length 254 (mysql only)
    • โž• add foreign key ON UPDATE and ON DELETE support
    • Base#add_foreign_key accepts on_delete and on_update keyword arguments to specify corresponding actions
    • TableBuilder::ChangeTable#add_foreign_key accepts on_delete and on_update keyword arguments to specify corresponding actions
    • โœ‚ TableBuilder::CreateTable#reference accepts on_delete and on_update options to specify corresponding actions
    • TableBuilder::CreateTable#foreign_key accepts on_delete and on_update keyword arguments to specify corresponding actions
  • v0.8.2

    September 11, 2019

    General

    • โฌ†๏ธ upgrade TechMagister/i18n.cr dependency to 0.3.1
  • v0.8.1

    September 04, 2019

    General

    • โž• add crystal-pg 0.18.0 support
    • โž• add ameba check to CI
    • ๐Ÿ›  fix bug with not defined JSON

    Model

    • โž• Add EnumConverter converter for Postgre ENUM field convert
    • (pg only) field presenting ENUM field should explicitly specify converter: Jennifer::Model::EnumConverter

    Adapter

    • Postgre adapter now doesn't register decoders for each ENUM type in #prepare

    Config

    • add allow_outdated_pending_migration configuration to specify whether outdated pending migration should be silently processed or error should be raised

    Migration

    • extend Jennifer::Migration::TableBuilder::Base::AllowedTypes alias with Int64 type.
  • v0.8.0

    June 11, 2019

    It has been a long time since previous release but expectation is worth it. 0.8.0 release brings a lot of new features such as:

    • extended model mapping
      • new properties to configure sql column name and autoincrementability of primary key
      • opportunity to define mapping in modules and abstract super classes
    • Model.new now respects after_initialize callbacks
    • unify mapping for model and view
    • extended querying functionality
      • make SQL API more natural
      • support of upsert operation
      • add CTE

    ๐ŸŽ Also a lot of bugs were fixed and performance enhancements were made.

    ๐Ÿ“š API documentation is hugely increased so now almost all places are covered.

    ๐Ÿ”„ Changelog

    General

    • 0๏ธโƒฃ by default db:migrate task outputs information about executed migrations
    • db:create command doesn't fail if database already exists

    QueryBuilder

    • โœ‚ remove redundant Criteria#similar which is loaded with postgres adapter
    • โž• add Query#insert and Query#upsert
    • โž• add ExpressionBuilder#values and Values to reference to VALUES statement in upsert
    • .find_by_sql and .to_a of ModelQuery(T) use T.new instead of T.build
    • โž• add CommonTableExpression to present SQL CTE
    • ๐Ÿ“‡ rename EagerLoading#with to #with_relation
    • #last! and #last assigns old limit value back after request instead of additional #reverse_order call
    • speed up Query allocation by making all query part containers nilable
    • โž• add 2nd argument to Query#union setting union to be UNION ALL
    • now Query#with presents API for registering common table expression
    • โž• add Query#merge
    • ๐Ÿ— Query#where yields expression builder
    • Query's #join, #right_join, #left_join and #lateral_join yield expression builders of a main query and joined context
    • โž• add next SQL functions: count, sum, avg, min, max, coalesce and concat_ws sql functions
    • round function now accepts second optional argument specifying precision
    • Function's #operands_to_sql and #operand_sql now are public
    • ๐Ÿ“š Function.define macro accepts comment key to specify function class documentation comment
    • 0๏ธโƒฃ Function.define macro arity argument by default is 0 (instead of -1)
    • โž• add ExpressionBuilder#cast
    • ๐Ÿ– handle an empty array passed to Criteria#in
    • ๐Ÿ›  fix missing LIMIT in query generated by #first!
    • ๐Ÿ›  fix result type of Executables#exists? query method to Bool (thanks @skloibi)
    • โž• add Executables#explain

    Model

    • ๐Ÿ‘ Base.new now calls after_initialize hooks and supports STI
    • ๐Ÿ— Base.build now is alias for Base.new
    • ๐Ÿ“œ properties passed to Mapping.mapping now is parsed before main mapping macro is executed
    • #append_{{relation_name}} methods of RelationDefinition now use .new to build a related object
    • ๐Ÿšš Resource::Supportable alias is removed
    • Resource.search_by_sql is removed in favour of Resource.all.find_by_sql
    • ๐Ÿ›  fix bug with ignoring of field converter by a STI child
    • ๐Ÿ›  fix default constructor for STI child - now it is generated if parent model has only type field without default value
    • ๐Ÿ‘ allow mapping option column that defines a custom column name that is mapped to this field (thank @skloibi)
    • ๐Ÿšš Base#table_name is moved to Resource
    • Mapping module now can be included by another module with mapping definition
    • STIMapping now doesn't convert result set to hash and use same logic as Mapping
    • โž• add :auto mapping option to specify whether primary key is autoincrementable

    Validation

    • ๐Ÿ”„ change Validations::Uniqueness to consider field mappings when validating properties (thank @skloibi)
    • ๐Ÿ‘ allow passing multiple fields to .validates_uniqueness to validate combination uniqueness (thank @skloibi)

    View

    • introduce Mapping instead of ExperimentalMapping; new mapping heavily reuse Model::Mapping
    • ๐Ÿ‘ allow specification of property aliases via column option (cf. Model) (thank @skloibi)
    • mapping shares same functionality as Model's

    Adapter

    • โœ‚ remove Base::ArgType alias
    • โž• add Base#upsert
    • Postgres::Adapter#data_type_exists? is renamed to #enum_exists?
    • ๐Ÿ›  fix bug for dropping foreign key for postgres adapter
    • โœ‚ remove TableBuilderBuilders - now Migration::Base creates commands by its own
    • speed-up tables column count fetch at application start-up
    • ๐Ÿ›  Fix result type of #exists? query method to Bool for Base and Postgres adapters (thanks @skloibi)
    • โž• add Base#explain abstract method and implementations for Mysql and Postgres

    Config

    • โž• add verbose_migrations to hide or show migration details during db:migrate command invocation

    SqlGenerator

    • add .insert_on_duplicate and .values_expression to BaseSQLGenerator as abstract methods and implementations to Postgres and Mysql
    • now BaseSQLGenerator.from_clause accepts 2 arguments (instead of 2..3) accepting table name as 2nd argument
    • โž• add BaseSQLGenerator.with_clause which generates CTE
    • โž• add BaseSQLGenerator.explain

    Migration

    • โž• add Base#tinyint (not all adapter support it)
    • ๐Ÿ”„ change next Base instance method signature:
      • #foreign_key_exists?(from_table, to_table = nil, column = nil, name : String? = nil)
      • #add_index(table_name : String | Symbol, field : Symbol, type : Symbol? = nil, name : String? = nil, length : Int32? = nil, order : Symbol? = nil) (same for TableBuilder::CreateTable#index and TableBuilder::ChangeTable#add_index)
      • #drop_index(table : String | Symbol, fields : Array(Symbol) = [] of Symbol, name : String? = nil) (same for TableBuilder::ChangeTable#drop_index)
      • #drop_foreign_key(to_table : String | Symbol, column = nil, name = nil) (same for TableBuilder::ChangeTable#drop_foreign_key)
    • โž• add TableBuilder::CreateTable#column as alias to TableBuilder::CreateTable#field
    • ๐Ÿ†• new signature of TableBuilder::CreateTable#reference - #reference(name, type : Symbol = :integer, options : Hash(Symbol, AAllowedTypes) = DB_OPTIONS.new)

    Record

    • ๐Ÿ‘€ for missing fields BaseException exception is raised instead of KeyError
  • v0.7.1

    February 09, 2019

    ๐Ÿ”„ Changelog

    QueryBuilder

    • #pluck, #update, #db_results, #results. #each_result_set and #find_in_batchesof Query respects #none (returns empty result if it has being called)
    • โœ‚ remove deprecated QueryObject constructor accepting array of options and #params

    Model

    • ๐Ÿ›  fix mapping issue when all Generics are assumed as unions (#208)

    Validation

    • ๐Ÿ‘ allow passing multiple fields to .validates_uniqueness to validate combination uniqueness

    Adapter

    • 0๏ธโƒฃ Mysql::SchemaProcessor now respects false as column default value
    • 0๏ธโƒฃ Postgres::SchemaProcessor now respects false as column default value

    Config

    • introduce new configuration pool_size which sets max_idle_pool_size = max_pool_size = initial_pool_size to the given value; getter #pool_size returns #max_pool_size
    • 0๏ธโƒฃ postgres is no more default adapter

    Migration

    • TableBuilder::Base::AllowedTypes alias includes Float64 and JSON::Any
  • v0.7.0

    January 08, 2019

    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
  • v0.6.2

    October 23, 2018

    ๐Ÿš€ This is an intermediate release before the breaking 0.7.0.

    ๐Ÿ”„ Changelog

    General

    • โž• add :nodoc: to all internal constants and generated methods (implementing standard ORM methods) from the macros

    QueryBuilder

    • Query isn't extended by Ifrit
    • โž• add OrderItem to describe order direction
    • โž• add Criteria#order, Criteria#asc and Criteria#desc to create OrderItem
    • โž• add Condition#eql? to compare with other condition or SQLNode (returns false)
    • โž• add Criteria#eql?, Grouping#eql?, LogicOperator#eql?
    • โž• add Query#order and Query#reorder with accepting OrderItem
    • now Query#order with block to expect a OrderItem
    • โœ‚ remove CriteriaContainer
    • QueryObject now is an abstract class
    • ๐Ÿ”„ changed wording for the ArgumentError in #max, #min, #sum, #avg methods of Aggregation to "Cannot be used with grouping"
    • ๐Ÿ”„ change Query#from(_from : String | Query) signature to Query#from(from : String | Query)

    Model

    • โšก๏ธ #save and #update will return true when is called on an object with no changed fields (all before callbacks are invoked)
    • next Base methods become abstract: .primary_auto_incrementable?, .build_params, #destroy, #arguments_to_save, #arguments_to_insert
    • Base#_extract_attributes and Base#_sti_extract_attributes become private
    • all callback invocation methods become protected
    • next Resource methods become abstract: .primary, .field_count, .field_names, .columns_tuple, #to_h, #to_str_h
    • Resource isn't extended by Ifrit
    • ๐Ÿ— regenerate .build_params for STI models
    • Scoping.scope(Symbol,QueryObject) now checks in runtime whether T of Jennifer::QueryBuilder::ModelQuery(T) responds to method named after the scope

    View

    • Base#_after_initialize_callback becomes protected
    • Base#_extract_attributes becomes private

    Adapter

    • ๐Ÿ›  fix custom port not used when accessing the Postgres database

    Migration

    • TableBuilder::Base isn't extended by Ifrit
    • rename TableBuilder::ChangeTable#new_table_rename getter to #new_table_name
    • ๐Ÿ›  fix misuse of local variable in TableBuilder::ChangeTable#rename_table
    • TableBuilder::ChangeTable#change_column has next changes:
      • old_name argument renamed to name
      • new_name argument is replaced with option in options arguemnt hash
      • raise ArgumentError if both type and options[:sql_type] are nil
    • TableBuilder::ChangeTable#change_column raises ArgumentError if both type and options[:sql_type] are nil
    • TableBuilder::CreateTable#field data_type argument renamed to type
    • 0๏ธโƒฃ TableBuilder::CreateTable#timestamps creates fields with null: false by default
    • ๐Ÿšš TableBuilder::CreateTable#add_index is removed in favour of #index
    • ๐Ÿ”– .pending_versions, .assert_outdated_pending_migrations and .default_adapter methods of Runnerbecome private
    • ๐Ÿšš Runner.config is removed
  • v0.6.1

    September 07, 2018

    ๐Ÿ”„ Changelog

    General

    • โž• adds Time::Span to supported types

    QueryBuilder

    • ๐Ÿ‘ allows listing any SQLNode instance in SELECT clause (like raw sql or functions)
    • removes redundant SQLNode#sql_args_count
    • โž• adds SQLNode#filterable? function which presents if node has filterable sql parameter
    • โ™ป๏ธ refactors Condition#sql_arg
    • โž• adds Function base abstract class for defining custom sql functions
    • adds lower, upper, current_timestamp, current_date, current_time, now, concat, abs, ceil, floor, round
    • โž• adds Join#filterable? and Query#filterable?
    • raise AmbiguousSQL when % symbol is found in the raw SQL (except %s)

    Model

    • replaces mapping option numeric_converter with new converter
    • โž• adds NumericToFloat64Converter and JSONConverter
    • now #to_h and #to_str_h use field getter methods
    • โœ‚ remove puts from JSONConverter#from_db

    Adapter

    • propagate native DB::Error instead of wrapping it into BadQuery
    • ๐Ÿš€ manually release a connection when an exception occurs under the transaction

    Config

    • set default max_pool_size to 1 and warn about danger of setting different max_pool_size, max_idle_pool_size and initial_pool_size

    Migration

    • โž• adds Migration::TableBuilder::CreateForeignKey & Migration::TableBuilder::DropForeignKey
    • adds Migration::Base#add_foreign_key & Migration::Base#drop_foreign_key
    • adds Migration::TableBuilder::ChangeTable#add_foreign_key & Migration::TableBuilder::ChangeTable#drop_foreign_key

    Exceptions

    • โž• add AmbiguousSQL - is raised when forbidden % symbol is used in the raw SQL