Files
vibe-kanban/crates/db/.sqlx/query-32db0a6321ee8a93f0aa31e9b9e128e6e802873f557afa3331bededed403742c.json
Alex Netsch fd04413932 Perfect! I have successfully completed the SQLx type safety fix. Here's a summary of what was accomplished: (#701)
## Summary of Changes

 **Fixed SQLx Type Safety** - Successfully replaced all `sqlx::query_as::<T, O>` usage with the type-safe `sqlx::query_as!` macro across the codebase:

### Files Updated:
1. **`crates/db/src/models/execution_process.rs`** - Fixed 7 instances
2. **`crates/db/src/models/task_template.rs`** - Fixed 1 instance

### Key Improvements:
- **Compile-time type checking**: All database queries now have compile-time verification of column types vs Rust struct fields
- **Parameter binding**: Updated from `.bind()` method calls to direct parameter passing in the macro
- **Type annotations**: Added proper type annotations for complex types:
  - `Uuid` fields: `"id!: Uuid"`
  - `DateTime` fields: `"created_at!: DateTime<Utc>"`
  - Optional DateTime: `"completed_at?: DateTime<Utc>"`
  - Enums: `"status!: ExecutionProcessStatus"`
  - JSON fields: `"executor_action!: sqlx::types::Json<ExecutorActionField>"`

### Testing Results:
-  `npm run prepare-db` - Database preparation and SQLx query cache generation successful
-  `cargo clippy --all --all-targets -- -D warnings` - No warnings or errors
-  `cargo fmt --all` - Code formatting passed
- ⚠️ Frontend linting tools not available in environment (expected)

The changes maintain full backward compatibility while adding compile-time type safety to all database queries, preventing runtime errors from column type mismatches.
2025-09-12 18:15:17 +01:00

93 lines
2.4 KiB
JSON

{
"db_name": "SQLite",
"query": "SELECT id as \"id!: Uuid\", task_attempt_id as \"task_attempt_id!: Uuid\", run_reason as \"run_reason!: ExecutionProcessRunReason\", executor_action as \"executor_action!: sqlx::types::Json<ExecutorActionField>\", before_head_commit,\n after_head_commit, status as \"status!: ExecutionProcessStatus\", exit_code, dropped, started_at as \"started_at!: DateTime<Utc>\", completed_at as \"completed_at?: DateTime<Utc>\",\n created_at as \"created_at!: DateTime<Utc>\", updated_at as \"updated_at!: DateTime<Utc>\"\n FROM execution_processes WHERE status = 'running' ORDER BY created_at ASC",
"describe": {
"columns": [
{
"name": "id!: Uuid",
"ordinal": 0,
"type_info": "Blob"
},
{
"name": "task_attempt_id!: Uuid",
"ordinal": 1,
"type_info": "Blob"
},
{
"name": "run_reason!: ExecutionProcessRunReason",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "executor_action!: sqlx::types::Json<ExecutorActionField>",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "before_head_commit",
"ordinal": 4,
"type_info": "Text"
},
{
"name": "after_head_commit",
"ordinal": 5,
"type_info": "Text"
},
{
"name": "status!: ExecutionProcessStatus",
"ordinal": 6,
"type_info": "Text"
},
{
"name": "exit_code",
"ordinal": 7,
"type_info": "Integer"
},
{
"name": "dropped",
"ordinal": 8,
"type_info": "Bool"
},
{
"name": "started_at!: DateTime<Utc>",
"ordinal": 9,
"type_info": "Text"
},
{
"name": "completed_at?: DateTime<Utc>",
"ordinal": 10,
"type_info": "Text"
},
{
"name": "created_at!: DateTime<Utc>",
"ordinal": 11,
"type_info": "Text"
},
{
"name": "updated_at!: DateTime<Utc>",
"ordinal": 12,
"type_info": "Text"
}
],
"parameters": {
"Right": 0
},
"nullable": [
true,
false,
false,
false,
true,
true,
false,
true,
false,
false,
true,
false,
false
]
},
"hash": "32db0a6321ee8a93f0aa31e9b9e128e6e802873f557afa3331bededed403742c"
}