Files
vibe-kanban/crates/db/.sqlx/query-929cd77c5aa8015af36aa70ef830d030788b96aaddcef73aed4e8c7d7d5dee46.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.6 KiB
JSON

{
"db_name": "SQLite",
"query": "INSERT INTO execution_processes (\n id, task_attempt_id, run_reason, executor_action, before_head_commit,\n after_head_commit, status, exit_code, started_at, completed_at, created_at, updated_at\n ) VALUES (?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?) RETURNING\n 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>\", created_at as \"created_at!: DateTime<Utc>\", updated_at as \"updated_at!: DateTime<Utc>\"",
"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": 11
},
"nullable": [
true,
false,
false,
false,
true,
true,
false,
true,
false,
false,
true,
false,
false
]
},
"hash": "929cd77c5aa8015af36aa70ef830d030788b96aaddcef73aed4e8c7d7d5dee46"
}