Configure Database Connection
Basic PostgreSQL Connection
require "cql"
require "pg"
MyDB = CQL::Schema.define(
:my_db,
adapter: CQL::Adapter::Postgres,
uri: "postgres://username:password@localhost:5432/myapp_development"
) do
end
MyDB.initBasic SQLite Connection
require "cql"
require "sqlite3"
MyDB = CQL::Schema.define(
:my_db,
adapter: CQL::Adapter::SQLite,
uri: "sqlite3://./db/development.db"
) do
end
MyDB.initBasic MySQL Connection
Use Environment Variables
Connection String Format
PostgreSQL
MySQL
SQLite
Test Connection
Connection with Options (PostgreSQL)
Create Database Directory (SQLite)
Multiple Databases
Verify Connection
Related
Last updated
Was this helpful?