Working with Databases
What You'll Build
Prerequisites
Step 1: Add CQL Dependencies
name: user_api
version: 0.1.0
dependencies:
azu:
github: azutoolkit/azu
version: ~> 0.5.28
cql:
github: azutoolkit/cql
version: ~> 0.1.0
# Choose your database driver:
pg: # PostgreSQL
github: will/crystal-pg
# OR
# sqlite3: # SQLite (development)
# github: crystal-lang/crystal-sqlite3
crystal: >= 0.35.0
license: MITStep 2: Define the Schema
Step 3: Create the Database
Step 4: Create the Model
Step 5: Update Endpoints
Step 6: Update Main Application
Step 7: Adding Relationships
Step 8: Query Examples
Environment Configuration
Key Concepts Learned
Schema Definition
Model Definition
CRUD Operations
Next Steps
Last updated
Was this helpful?
