Releases: anykeyh/clear
Releases · anykeyh/clear
Clear v0.2
Clear is now in v0.2 !
Promise changes include JSONB and tsvector integration !
Numerous bugs have been fixed, and a lot of specs have been created to cover more part of the application.
Breaking changes
- Migration to crystal 0.25.
Bug fixes
- Fix #13 Calling count on paginated query.
- Fix #17 and implement
group_by
method. - Fix #18 ambiguous column with joins.
Features
- Full Text Searchable module using tsvector to simplify... full text search !
- SQL Builder can now be used with model collection as subqueries.
- Add methods for pagination (PR #16, thanks @jwoertink)
- Add multi-connections system (PR #18, thanks @russ)
- Add JSONB helpers in expression engine. Check the manual !
- Migrating the wiki to the sources of the project, to make easy to have PR for
updating the documentation ! - Add range support for
Sql::Node#in?
method:last_week_users = User.query.where{ created_at.in?(7.day.ago..Time.now) }.count
- Refactoring of the nodes and clause of the SQL builder, avoiding array instantiation (usage of tuple instead) and starting to use Node as much as possible to build clauses.
- Add
Clear::Expression.unsafe
which does exactly what it says:where("a = :a AND b = :b", {a: "test", b: Clear::Expression.unsafe("NOW()") }) # -> WHERE a = 'test' AND b = NOW()
v0.1-alpha3
Breaking changes
- Renaming of column
column
attribute tocolumn_name
incolumn
method helper - Renaming of
field
bycolumn
in validationError
record - Renaming of
Clear::Util.func
toClear::Util.lambda
order_by
don't allow full string anymore, and will cause error in case you put string.
Bugfixes
- Patching segfault caused by weird architecture choice of mine over the
pkey
method. - Fix issue with delete if the primary key is not
id
- Add watchdog to disallow inclusion of
Clear::Model
on struct objects, which
is not intended to work. - Issue #8:
find_or_create
and generally update without any field failed to generate good SQL. - Issue with
belongs_to
assignment fixed. - Fix error message when a query fail to compile, giving better insights for the developer.
- Issue #12: Fix
Collection(Model)#last
. - Allow
fetch_columns
on last, first etc...
Small features
- Add CHANGELOG.md file !
model.valid!
return itself and can be chained- Issue #10:
scope
allow block with multiple arguments. - Add tuple support for
in?
method in Expression Engine.
Big features
- Creation of the Wiki manual ! Check it out !
Polymorphism (experimental)
You can now use polymorph models with Clear !
Here for example:
abstract class Document
include Clear::Model
column content : String
self.table = "documents"
polymorphic ImageDocument, TextDocument
abstract def to_html : String
end
class ImageDocument < Document
column url : String
def to_html
<<-HTML
<img src='#{url}' alt='#{content}'></img>
HTML
end
end
class TextDocument < Document
def to_html
<<-HTML
<p>#{content}</p>
HTML
end
end
#...
# Create a new document
ImageDocument.create({url: "http://example.com/url/to/img.jpg"})
# Use the abstract class to query !
Document.query.all.each do |document|
puts document.to_html
end
v0.1-alpha2
I've finally started a "production" project with Clear ORM ! So I found dozen of bugs; two critical bugs have been found, and have been fixed:
- Migration manager was accessing to Postgres on instantiation. It was not looking like a problem on the specs, but eventually when I started to write down my migrations, nothing was working 🤣
- Issues with timezone prevented the ORM to save correctly the Date in the database. It's now fixed: Date are stored at GMT hours in PG, and shown as server local timezone in the ORM.
- Many others "minors" issues have been founds.
The next move will be to finalize the CLI.
I'm currently working on a draft scaffolding project with kemal, clear and tree_template.
Thus it will allow CLI to generate all the files to start working with Clear + Kemal.
Once the CLI is stable enough, I'll build a release candidate, without the pre-release flag 👍 .
Cheers,
Clear v0.1-alpha
What's inside this release:
- Field mapping
- All logic of transaction, update, saving...
- Basic SQL: Select/Insert/Update/Delete
- Hook callback
- Cursored fetching
- Debug Queries & Pretty Print
- Scope
- Locks
- Relations
- Having clause
- CTE
- Caching for N+1 Queries
- Migrations
- Validation