CQL
AzuAuthorityGithub
  • README
  • Introduction
  • Installation
  • Core Concepts
    • Schema Definition
    • Initializing Schema
    • Altering Schema
    • Migrations
    • CRUD Operations
      • Creating Records
      • Reading Records
      • Updating Records
      • Deleting Records
    • Patterns
      • Active Record
      • Entity Framework
      • Repository
  • Guides
    • Getting Started
    • Active Record with CQL
      • Defining Models
      • CRUD Operations
      • Querying
      • Complex Queries
      • Persistence Details
      • Validations
      • Callbacks
      • Transactions
      • Optimistic Locking
      • Relations
        • Belongs To
        • Has One
        • Has Many
        • Many To Many
      • Database Migrations
      • Scopes
      • Pagination
    • Transaction Management
    • Handling Migrations
  • Troubleshooting
  • FAQs
Powered by GitBook
On this page
  • Step 1: Add Dependency
  • Step 2: Install Shards
  • Step 3: Configure Database
  • Step 4: Create the Schema

Was this helpful?

Export as PDF

Installation

To get started with CQL in your Crystal project, follow these steps:

Step 1: Add Dependency

First, add CQL to your project by including it in the shard.yml file:

dependencies:
  cql:
    github: azutoolkit/cql
    version: "~> 0.1.0"

Step 2: Install Shards

Run the following command to install the dependencies:

shards install

Step 3: Configure Database

Set up your database connection by specifying the adapter and connection URL. This is done by configuring the database in your code, as follows:

"postgres://user:password@localhost:5432/database_name"

In this example, we’re using PostgreSQL. You can change the URL according to your database (MySQL, SQLite, etc.).

Step 4: Create the Schema

Now you can define your schema and run migrations (explained in later sections).

PreviousIntroductionNextCore Concepts

Last updated 8 months ago

Was this helpful?