Skip to content

Releases: amberframework/granite

Handle string conversion and errors

17 Aug 18:44
Compare
Choose a tag to compare

e2784bf Handle string conversion & conversion errors (#357) by @Blacksmoke16

Crystal 0.30.0 and DSL breaking changes

07 Aug 03:44
a866c10
Compare
Choose a tag to compare

This release has some significant breaking changes to the DSL and leverages Annotations instead of the mutable constants and final macros. @Blacksmoke16 spent many months researching the use of Annotations and has overhauled Granite to take advantage of them.

In the process, we have decided to change the DSL to be more database centric. Here is a list of the breaking changes:

  • Adapters are now added to Granite::Connections array instead of Granite::Adapters
  • the adapter macro was renamed to connection
  • the table_name macro was renamed to table
  • the field macro was renamed to column
  • the primary macro was changed into a flag primary: true on the column macro
  • a primary id field is no longer added by default
  • a column can be declared as Nilable using ?

Here is an example of how to register a new connection:

Granite::Connections << Granite::Adapter::Mysql.new(name: "mysql", url: "YOUR_DATABASE_URL")

Here is an example of a model:

require "granite/adapter/mysql"

class Post < Granite::Base
  connection mysql
  table posts # Name of the table to use for the model, defaults to class name snake cased

  column id : Int64, primary: true # Primary key, defaults to AUTO INCREMENT
  column name : String? # Nilable field
  column body : String # Not nil field
end

Other changes:

Crystal 0.29.0 Support

08 Jun 22:47
d9ab302
Compare
Choose a tag to compare

v0.15.2

07 Jan 02:41
Compare
Choose a tag to compare

Support default values (#312) @Blacksmoke16
Add colors to logged queries (#311) @Blacksmoke16
Implement #touch (#314) @Blacksmoke16
Support array IN queries with query builder (#313) @Blacksmoke16

v0.15.1

22 Dec 03:34
Compare
Choose a tag to compare

add timezone support #310 - @icyleaf
Association improvements #307 - @Blacksmoke16

v.0.15.0

03 Nov 14:31
Compare
Choose a tag to compare

Include clause when using custom select statement - #305 by @hfjallemark
Belongs_to refactor - #304 by @Blacksmoke16
Use env vars to specify sqlite version - #303 by @Blacksmoke16
Crystal 0.27.0 - #302 by @Blacksmoke16
Only define updated/created_at properties if they are wanted - #301 by @Blacksmoke16
Fix Assembler#count - #299 by @c910335
Add support for AND and OR clause - #297 by @drujensen
Test PG11 on travis - #294 by @Blacksmoke16
Better UUID support - #293 by @Blacksmoke16

v0.14.2

16 Oct 21:37
Compare
Choose a tag to compare

Query Builder support Mysql and Sqlite (#285) @drujensen
Support PG Array Types (#286) @Blacksmoke16
Crystal 0.26.1 Support (#288) @Blacksmoke16
Annotation Support (#289) @Blacksmoke16
Extend Query Builder (#290) @drujensen
Update Query Documentation (#292) @drujensen

v0.14.1

09 Oct 23:26
Compare
Choose a tag to compare

Add limit and offset to QueryBuilder, mild refactoring (#284) @c910335
Refactored the validator helpers and added exclusion validator (#283) @Thellior
add spaces (#281) @drujensen
list the documentation instead of the docs directory (#280) @drujensen

v0.14.0

09 Sep 22:02
Compare
Choose a tag to compare

Clear errors before validating models (#279) @yumoose

Breaking Changes

Dj/129 has many (#278) @drujensen

v0.13.1

29 Aug 18:55
Compare
Choose a tag to compare

Dj/lazy load connection (#277) @drujensen
Test multiple databases (#270) @Thellior
Example for String foreign_key (#265) @winhackua
Dj/271 maintain one database connection (#274) @drujensen
Has one relationship (#264) @zaidakram
Make the "through class" a symbol (#269) @Hansterdam