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 invokesdb:seed
afterdb:migrate
QueryBuilder
- โ add
#and
,#or
and#xor
shortcut methods toExpressionBuilder
Criteria#in
now acceptsSQLNode
as well- โ add
Statement
module with base abstract functionality needed for query string generating ExpressionBuilder#g
and#group
now has no argument type restrictionGrouping#condition
now can be ofStatement
typeQuery
includesStatement
Query#to_sql
now is#as_sql
,#select_args
-#sql_args
Condition
includesStatement
- โก๏ธ
Executables#update
accepts block expectingHash(Symbol, Statement)
to be returned - โก๏ธ
Executables#modify
is removed in favor of new#update
method accepting block - now
LogicOperator
is inherited fromSQLNode
#delete
andexists?
ofExecutables
do nothing when#do_nothing?
istrue
- โ add
Query#do_nothing?
- โ add
Query.null
which returnsQuery.new.none
Join
acceptsGrouping
forON
condition
Model
- remove
Base.build_params
,Base.parameter_converter
methods - โ remove
ParameterConverter
class - ๐ fix skipping generating default constructor by
Mapping.mapping
when at least one field has default value and all others are nilable - ๐
stringified_type
option is removed from theCOLUMNS_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 toTranslation::ClassMethods
which is automatically extended by target class usingincluded
macro #lookup_ancestors
and#human_attribute_name
methods ofTranslation
are added- ๐
Errors#base
now is type ofTranslation
instead ofBase
- โ add
Base#persisted?
- now attribute-specific rendering for
Resource#inspect
is generated by.mapping
- add polymorphic relation support for
has_one
,has_many
andbelongs_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
andRelation::PolymorphicHasOne
@new_record
,@destroyed
,@errors
, changeset and relation attributes now is ignored byJSON::Serializable
- add
skip_validation
argument toAuthentication.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 alsoJennifer::DBAny
- rename
Base#update_attributes
toBase#set_attributes
Validation
- all validation macros now accept
:if
key; the value may be bothSymbol
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 ofJennifer::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 toTableBuilderBuilders
module - fix syntax in
SchemaProcessor#drop_foreign_key
- all
_query
arguments inBase
methods are renamed toquery
- ๐
Base.extract_arguments
is removed .delete
,.exists
and.count
ofBaseSQLGenerator
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
andRunner::MIGRATION_DATE_FORMAT
TableBuilder::CreateTable#reference
triggers#foreign_key
and acceptspolymorphic
bool argument presenting whether additional type column should be added; for polymorphic reference foreign key isn't added
Exceptions
- ๐ 'RecordNotFound' from
QueryBuilder::Query#first!
andQueryBuilder::Query#last!
includes detailed parsed query
- โฌ๏ธ bump