-
Notifications
You must be signed in to change notification settings - Fork 32
Setup
Yacine Petitprez edited this page Jun 7, 2018
·
6 revisions
In shards.yml, please add theses lines:
dependencies:
clear:
github: anykeyh/clearThen in your code, add the requirement:
require "clear"Connection can be initialized by Clear::SQL.init(uri) method:
Clear::SQL.init("postgres://[USER]:[PASSWORD]@[HOST]/[DATABASE]")You can fine tune your connection, accessible by the Clear::SQL.connection object. Check the will/crystal-pg shards documentations for more informations.
Additional parameters like retry_attempts, retry_delay etc... can be passed to the URI. Please check the official db documentation
By choice, Clear doesn't offers any configuration file (e.g. database.yml), so you need to setup your own architecture to handle different build targets.
By default, logging of SQL output is disabled. To enable it, you need to change the logger verbosity level:
Clear.logger.level = ::Logger::DEBUG