Changelog History
-
v0.2.7 Changes
April 13, 2017 -
v0.2.6 Changes
March 25, 2017 -
v0.2.5 Changes
March 10, 2017π This release includes following topics.
- π bug fix of time format for PostgreSQL.(See #3)
-
v0.2.4 Changes
February 23, 2017π I'm happy to announce to release new tool that build a kemal project with topaz. π
You can simply start with it like/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/topaz-crystal/topaz/master/tools/install.rb)"
π This release includes bug fixes and refactoring.
-
v0.2.3 Changes
January 02, 2017β‘οΈ Updates
- π Support table migration!π Doc
- π Bug fixes (Especially for PostgreSQL)
-
v0.2.2 Changes
December 26, 2016π± Suppoort Crystal version 0.20.3 π
π Nullable column is accepted.(See below sample)
Support to_json and from_json(#json
is deprecated)
Topaz::Log.show_query
is nowTopaz::Db.show_query
class NullableModel < Topaz::Model columns( name: String, nullable: {type: String, nullable: true}, not_nullable: {type: String, nullable: false}, ) end NullableModel.create("sample", nil, "not nullable")
-
v0.2.1 Changes
December 17, 2016- π Support transaction! π (Thanks @bcardiff)
- π
join
is deprecated
π See sample/transaction.cr as a sample code
[Sample code] Topaz::Db.shared.transaction do |tx| Sample.in(tx).create("sample0") Sample.in(tx).create("sample1") ... t0 = Sample.in(tx).find(1) t0.in(tx).update(name: "sample0 updated") end
-
v0.2.0 Changes
December 14, 2016- π Support PostgreSQLπ (Thanks @will and @asterite)
- Simplify core macros(columns, has_many, belongs_to)
- π
primary
is deprecated (You have to control it on code level)
Example:
Previous
class Parent \< Topaz::Model columns( {name: name, type: String} ) has\_many( {model: Child, as: childlen, key: p\_id} )end
Now
class Parent \< Topaz::Model columns( name: String ) has\_many( childlen: {model: Child, key: p\_id} )end
-
v0.1.0 Changes
December 09, 2016Version 0.1.0
π± Now Topaz is enough stable so that increment minor version from 0 to 1 π
β¬οΈ Reduced Database overhead by keeping opening connection with it. Thanks @asterite !Any issues or PRs are welcome :)
-
v0.0.5 Changes
December 07, 2016Converting models to jsons is a necessary feature for who develops api server.
Now your api easily generate and return jsons of models with Topaz.For example, when we have
JsonParent(name) - JsonChild(age, p_id) - JsonToy(name, price, c_id) - JsonPart(t_id) - JsonPet(p_id)
Then we can write like
p = JsonParent.select.firstputs p.jsonputs p.json({include: :childlen, except: :id})puts p.json({include: {childlen: {except: [:id, :p\_id]}, pets: nil} })puts p.json({include: {childlen: {include: {toies: {include: :parts, only: :price} } }, pets: nil} })
We got
{"id": 1, "name": "John"} {"name": "John", "childlen": [{"id": 1, "age": 12, "p_id": 1}, {"id": 2, "age": 15, "p_id": 1}, {"id": 3, "age": 23, "p_id": 1}]} {"id": 1, "name": "John", "childlen": [{"age": 12}, {"age": 15}, {"age": 23}], "pets": [{"id": 1, "p_id": 1}, {"id": 2, "p_id": 1}, {"id": 3, "p_id": 1}, {"id": 4, "p_id": 1}]} {"id": 1, "name": "John", "childlen": [{"id": 1, "age": 12, "p_id": 1, "toies": [{"price": 10, "parts": [{"id": 1, "t_id": 1}]}, {"price": 12, "parts": []}]}, {"id": 2, "age": 15, "p_id": 1, "toies": [{"price": 15, "parts": [{"id": 2, "t_id": 3}, {"id": 3, "t_id": 3}, {"id": 4, "t_id": 3}]}]}, {"id": 3, "age": 23, "p_id": 1, "toies": []}], "pets": [{"id": 1, "p_id": 1}, {"id": 2, "p_id": 1}, {"id": 3, "p_id": 1}, {"id": 4, "p_id": 1}]}