- Remove
vitamin-query
dependency - Update the
Collection
API (add search, promise and other methods)
- Add the belongs-to-many relationship
toggle
method - Update README.md
- Fix some bugs
This is a breaking changes version, Vitamin become a Data Mapper implementation instead of the Active Record. So the mapping logic was moved to the
Mapper
class
- Export the
BaseModel
,BaseQuery
andEvents
to separate projects - Wrote in ES6 style and use
babeljs
as compiler - Add the polymorphic relationships
- Add models registry
- Provide a new API
- Add Attribute accessors and mutators feature
- Add query method
paginate()
for simple pagination - Add query method
value()
to get a value of a single column - Add
increment()
anddecrement()
model methods - Change
connection()
to return the current DB connection if no parameter passed in
- Add
pluck()
,count()
,sum()
,min()
,max()
andavg()
query methods - Add
sync()
method to enhance many-to-many associations
- Fix:
model.get()
which returnsundefined
for falsy values - Fix:
attach()
anddetach()
to accept also model collections - Add
findMany
,findOrNew
,firstOrNew
,firstOrCreate
Query helpers - Add a new life-cycle event:
ready
to add more initialization logic model.fetch()
accept an array of relations, as first argument, to fetch with
- Fix: for eager loading, for no parent models, we resolve without loading relationships (Performance)
- Add
newExistingInstance()
helper method in model class - Add default attributes hash to init the model's data
- Add protection against mass assignment
- Add the ability to blacklist attributes from
toJSON()
- Add
collections
to be used instead of arrays for relations
- Rename many-to-many joining table as
pivot
for fluent querying - Fix:
load()
to resolve with the current model - Fix:
getOriginal()
to return a copy of the original hash - Add default message for custom errors
- Add relationship methods:
create()
,createMany()
,save()
,saveMany()
andupdatePivot()
- First release as an Active Record library