A persistence layer for Hanami
- [Sean Collins] Specify dependency on BigDecimal v1.4
- [Adam Daniels] Use environment variables for PostgreSQL CLI tools
- [Luca Guidi] Depend on
dry-logic
~> 0.4.2
,< 0.5
- [Luca Guidi] Official support for Ruby: MRI 2.6
- [Luca Guidi] Support
bundler
2.0+
- [Luca Guidi] Print meaningful error message when connection URL is misconfigured (eg.
Unknown database adapter for URL: "". Please check your database configuration (hint: ENV['DATABASE_URL']).
) - [Ian Ker-Seymer] Reliably parse query params from connection string
- [Marcello Rocha & Luca Guidi] Ensure repository relations to access database attributes via
#[]
(eg.projects[:name].ilike("Hanami")
)
- [Luca Guidi] Official support for Ruby: MRI 2.5
- [Marcello Rocha] Introduce
Hanami::Repository#command
as a factory for custom database commands. This is useful to create custom bulk operations.
- [Luca Guidi] Ensure associations to always accept objects that are serializable into
::Hash
- [Marcello Rocha] Added support for associations aliasing via
:as
option (has_many :users, through: :comments, as: :authors
) - [Luca Guidi] Allow entities to be used as type in entities manual schema (
attribute :owner, Types::Entity(User)
)
- [Alfonso Uceda] Introduce
Hanami::Model::Migrator#rollback
to provide database migrations rollback - [Alfonso Uceda] Improve connection string for PostgreSQL in order to pass credentials as URI query string
- [Marcello Rocha] One-To-Many properly destroy the associated methods
- [Marcello Rocha] Many-To-One association (aka
belongs_to
) - [Marcello Rocha] One-To-One association (aka
has_one
) - [Marcello Rocha] Many-To-Many association (aka
has_many :through
) - [Luca Guidi] Introduced new extra behaviors for entity manual schema:
:schema
(default),:strict
,:weak
, and:permissive
- [Sean Collins] Enhanced error message for Postgres
db create
anddb drop
whencreatedb
anddropdb
aren't inPATH
- [Nikita Shilnikov] Keep the dependency on
rom-sql
at~> 1.3
, which is compatible withdry-types
~> 0.11.0
- [Nikita Shilnikov] Ensure to write Postgres JSON (
PGJSON
) type for nested associated records - [Nikita Shilnikov] Ensure
Repository#select
to work withHanami::Model::MappedRelation
- [Luca Guidi] Keep the dependency on
dry-types
at~> 0.11.0
- [Maurizio De Magnis] URI escape for Postgres password
- [Marion Duprey] Ensure repository to generate timestamps values even when only one between
created_at
andupdated_at
is present - [Paweł Świątkowski] Make Postgres JSON(B) to work with Ruby arrays
- [Luca Guidi] Don't remove migrations when running
Hanami::Model::Migrator#apply
fails to dump the database
- [Kai Kuchenbecker & Marcello Rocha & Luca Guidi] Ensure
Hanami::Entity#initialize
to not serialize (intoHash
) other entities passed as an argument - [Luca Guidi] Let
Hanami::Repository.relation=
to accept strings as an argument - [Nikita Shilnikov] Prevent stack-overflow when
Hanami::Repository#update
is called thousand times
- [Luca Guidi] Introduced
Hanami::Model.disconnect
to disconnect all the active database connections
- [Semyon Pupkov] Allow to define Postgres connection URL as
"postgresql:///mydb?host=localhost&port=6433&user=postgres&password=testpasswd"
- [Marcello Rocha] Fixed migrations MySQL detection of username and password
- [Luca Guidi] Fixed migrations creation/drop of a MySQL database with a dash in the name
- [Semyon Pupkov] Ensure
db console
to work when Postgres connection URL is defined with"postgresql://"
scheme
- [Luca Guidi] Official support for Ruby: MRI 2.4
- [Luca Guidi] Introduced
Repository#read
to fetch from database with raw SQL string - [Luca Guidi] Introduced
Repository.schema
to manually configure the schema of a database table. This is useful for legacy databases where Hanami::Model autoinferring doesn't map correctly the schema. - [Luca Guidi & Alfonso Uceda] Added
Hanami::Model::Configuration#gateway
to configure gateway and the raw connection - [Luca Guidi] Added
Hanami::Model::Configuration#logger
to configure a logger - [Luca Guidi] Database operations (including migrations) print informations to standard output
- [Thorbjørn Hermansen] Ensure repository to not override given timestamps
- [Luca Guidi] Raise
Hanami::Model::MissingPrimaryKeyError
ifRepository#find
is ran against a database w/o a primary key - [Alfonso Uceda] Ensure SQLite databases to be used on JRuby when the database path is in the same directory of the Ruby script (eg.
./test.sqlite
)
- [Luca Guidi] Automap the main relation in a repository, by removing the need of use
.as(:entity)
- [Luca Guidi] Raise an
Hanami::Model::UnknownDatabaseTypeError
when the application is loaded and there is an unknown column type in the database
- [Luca Guidi]
Hanami::Entity
defines an automatic schema for SQL databases – [Luca Guidi]Hanami::Entity
attributes schema - [Luca Guidi] Experimental support for One-To-Many association (aka
has_many
) - [Luca Guidi] Native support for PostgreSQL types like UUID, Array, JSON(B) and Money
- [Luca Guidi] Repositories instances can access all the relations (eg.
BookRepository
can accessusers
relation via#users
) - [Luca Guidi] Automapping for SQL databases
- [Luca Guidi] Added
Hanami::Model::DatabaseError
- [Luca Guidi] Entities are immutable
- [Luca Guidi] Removed support for Memory and File System adapters
- [Luca Guidi] Removed support for dirty tracking
- [Luca Guidi]
Hanami::Entity.attributes
method no longer accepts a list of attributes, but a block to optionally define typed attributes - [Luca Guidi] Removed
#fetch
,#execute
and#transaction
from repository - [Luca Guidi] Removed
mapping
block fromHanami::Model.configure
- [Luca Guidi] Changed
adapter
signature inHanami::Model.configure
(useadapter :sql, ENV['DATABASE_URL']
) - [Luca Guidi] Repositories must inherit from
Hanami::Repository
instead of including it - [Luca Guidi] Entities must inherit from
Hanami::Entity
instead of including it - [Pascal Betz] Repositories use instance level interface (eg.
BookRepository.new.find
instead ofBookRepository.find
) - [Luca Guidi] Repositories now accept hashes for CRUD operations
- [Luca Guidi]
Hanami::Repository#create
now accepts: hash (or entity) - [Luca Guidi]
Hanami::Repository#update
now accepts two arguments: primary key (id
) and data (or entity) - [Luca Guidi]
Hanami::Repository#delete
now accepts: primary key (id
) - [Luca Guidi] Drop
Hanami::Model::NonPersistedEntityError
,Hanami::Model::InvalidMappingError
,Hanami::Model::InvalidCommandError
,Hanami::Model::InvalidQueryError
- [Luca Guidi] Official support for Ruby 2.3 and JRuby 9.0.5.0
- [Luca Guidi] Drop support for Ruby 2.0, 2.1, 2.2, and JRuby 9.0.0.0
- [Luca Guidi] Drop support for
mysql
gem in favor ofmysql2
- [Luca Guidi] Ensure booleans to be correctly dumped in database
- [Luca Guidi] Ensure to respect default database schema values
- [Luca Guidi] Ensure SQL UPDATE to not override non-default primary key
- [James Hamilton] Print appropriate error message when trying to create a PostgreSQL database that is already existing
- [Kjell-Magne Øierud] Ensure inherited entities to expose attributes from base class
- [Hélio Costa e Silva & Pascal Betz] Mapping SQL Adapter's errors as
Hanami::Model
errors
- [Hélio Costa e Silva & Pascal Betz] Mapping SQL Adapter's errors as
Hanami::Model
errors
- [Luca Guidi] Renamed the project
- [Sean Collins] Improved error message for
Lotus::Model::Adapters::NoAdapterError
- [Kyle Chong & Trung Lê] Catch Sequel exceptions and re-raise as
Lotus::Model::Error
- [Taylor Finnell] Let
Lotus::Model::Configuration#adapter
to accept arbitrary options (eg.adapter type: :sql, uri: 'jdbc:...', after_connect: Proc.new { |connection| connection.auto_commit(true) }
)
- [Andrey Deryabin] Improved
Entity#inspect
- [Karim Tarek] Introduced
Lotus::Model::Error
and let all the framework exceptions to inherit from it.
- [Luca Guidi] Improved error message when trying to use a repository without mapping the corresponding collections
- [Sean Collins] Improved error message when trying to create database, but it fails (eg. missing
createdb
executable) - [Andrey Deryabin] Improved error message when trying to drop database, but a client is still connected (useful for PostgreSQL)
- [Hiếu Nguyễn] Improved error message when trying to "prepare" database, but it fails
- [Brenno Costa] Official support for JRuby 9k+
- [Luca Guidi] Command/Query separation via
Repository.execute
andRepository.fetch
- [Luca Guidi] Custom attribute coercers for data mapper
- [Alfonso Uceda] Added
#join
and#left_join
and#group
to SQL adapter
- [Luca Guidi]
Repository.execute
no longer returns a result from the database.
- [Manuel Corrales] Use
dropdb
to drop PostgreSQL database. - [Luca Guidi & Bohdan V.] Ignore dotfiles while running migrations.
- [Nick Coyne] Fixed database creation for PostgreSQL (now it uses
createdb
).
- [Luca Guidi] Database migrations
- [Matthew Bellantoni] Made
Repository.execute
not callable from the outside (private Ruby method, public API).
- [Dmitry Tymchuk & Luca Guidi] Fix for dirty tracking of attributes changed in place (eg.
book.tags << 'non-fiction'
)
- [Dmitry Tymchuk] Dirty tracking for entities (via
Lotus::Entity::DirtyTracking
module to include) - [My Mai] Automatic update of timestamps when an entity is persisted.
- [Peter Berkenbosch] Introduced
Lotus::Repository#execute
, to execute raw query/commands against database (eg.BookRepository.execute "SELECT * FROM users"
orBookRepository.execute "UPDATE users SET admin = 'f'"
) - [Guilherme Franco] Memory and File System adapters now accept a block for
where
,or
,and
conditions (egwhere { age > 33 }
).
- [Luca Guidi] Ensure Array coercion to preserve original data structure
- [Linus Pettersson] Database console
- [Alfonso Uceda Pompa] Don't send unwanted null values to the database, while coercing entities
- [Jan Lelis] Do not define top-level
Boolean
, because it is already defined byhanami-utils
- [Vsevolod Romashov] Fix entity class resolving in
Coercer#from_record
- [Jason Harrelson] Add file and line to
instance_eval
inCoercer
to make backtrace more usable
- [Luca Guidi] When duplicate the framework don't copy over the original
Lotus::Model
configuration
- [Alfonso Uceda Pompa] Added support for database transactions in repositories
- [Luca Guidi] Ensure file system adapter old data is read when a new process is started
- [Luca Guidi] Coerce entities when persisted
- [Luca Guidi] Compatibility between Lotus::Entity and Lotus::Validations
- [Luca Guidi] Introduced file system adapter
– [Benny Klotz & Trung Lê] Introduced
Entity
inheritance of attributes - [Trung Lê] Introduced
Entity#update
for bulk update of attributes - [Luca Guidi] Improved error when try to use a repository which wasn't configured or when the framework wasn't loaded yet
- [Trung Lê] Introduced
Entity#to_h
- [Trung Lê] Introduced
Lotus::Model.duplicate
- [Trung Lê] Made
Lotus::Mapper
lazy - [Trung Lê] Introduced thread safe autoloading for adapters
- [Felipe Sere] Add support for
Symbol
coercion - [Celso Fernandes] Add support for
BigDecimal
coercion - [Trung Lê] Introduced
Lotus::Model.load!
as entry point for loading - [Trung Lê] Introduced
Mapper#repository
as DSL to associate a repository to a collection - [Trung Lê & Tao Guo] Introduced
Configuration#mapping
as DSL to configure the mapping - [Coen Wessels] Allow
where
,exclude
andor
to accept blocks - [Trung Lê & Tao Guo] Introduced
Configuration#adapter
as DSL to configure the adapter - [Trung Lê] Introduced
Lotus::Model::Configuration
- [Trung Lê] Changed
Entity.attributes=
toEntity.attributes
- [Trung Lê] In case of missing entity, let
Repository#find
returnsnil
instead of raise an exception
- [Rik Tonnard] Ensure correct behavior of
#offset
in memory adapter - [Benny Klotz] Ensure
Entity
to set the attributes even when the given Hash uses strings as keys - [Ben Askins] Always return the entity from
Repository#persist
- [Jeremy Stephens] Made
Memory::Query#where
and#or
behave more like the SQL counter-part
- [Stanislav Spiridonov] Ensure to require
'hanami/model/mapping/coercions'
- [Krzysztof Zalewski]
Entity
defines#id
accessor by default
- [Luca Guidi] Introduced
Lotus::Model::Mapping::Coercions
in order to decouple fromLotus::Utils::Kernel
- [Luca Guidi] Official support for Ruby 2.1
- [Luca Guidi] Allow to inject coercer into mapper
- [Luca Guidi] Introduced database mapping
- [Luca Guidi] Introduced
Lotus::Entity
- [Luca Guidi] Introduced SQL adapter
- [Luca Guidi] Introduced memory adapter – [Luca Guidi] Introduced adapters for repositories
- [Luca Guidi] Introduced
Lotus::Repository