Avoid building a host SQLite driver for SQLx macros (#47084)

## Why

Row derives and migration embedding do not need query macros or a host SQLite driver.

## What changed

- Remove the `macros` feature from `sqlx` and depend directly on `sqlx-macros` with only `derive` and `migrate` enabled.
- Update state and thread-store derives and migration embedding to use `sqlx_macros`.
- Enable `sqlx-sqlite`'s `offline` feature directly to preserve query-description support in the target driver.
- Pin `sqlx`, `sqlx-macros`, and `sqlx-sqlite` to `=0.9.0` to keep their versions aligned.

GitOrigin-RevId: 8a8ef691ff2862a7dad978a578c5206b52dfc0b6
This commit is contained in:
Ahmed Ibrahim
2026-09-21 18:30:31 +00:00
committed by copyberry
parent 429afbcaa9
commit 3627bb91b2
8 changed files with 23 additions and 14 deletions
+3 -1
View File
@@ -4677,6 +4677,8 @@ dependencies = [
"serde",
"serde_json",
"sqlx",
"sqlx-macros",
"sqlx-sqlite",
"strum 0.27.2",
"tokio",
"tracing",
@@ -4766,6 +4768,7 @@ dependencies = [
"serde",
"serde_json",
"sqlx",
"sqlx-macros",
"tempfile",
"thiserror 2.0.18",
"tokio",
@@ -14695,7 +14698,6 @@ dependencies = [
"sqlx-postgres",
"sqlx-sqlite",
"syn 2.0.117",
"thiserror 2.0.18",
"tokio",
"url",
]
+6 -3
View File
@@ -468,11 +468,10 @@ symphonia = { version = "0.6.0", default-features = false, features = [
"wav",
] }
socket2 = "0.6.1"
# When bumping sqlx, audit the SQLite constructor deny list in clippy.toml.
sqlx = { version = "0.9.0", default-features = false, features = [
# Keep SQLx versions in sync; when bumping, audit the SQLite constructor deny list in clippy.toml.
sqlx = { version = "=0.9.0", default-features = false, features = [
"chrono",
"json",
"macros",
"migrate",
"runtime-tokio",
"tls-rustls",
@@ -480,6 +479,10 @@ sqlx = { version = "0.9.0", default-features = false, features = [
"time",
"uuid",
] }
# Derives and migration embedding do not need query macros or a host SQLite driver.
sqlx-macros = { version = "=0.9.0", default-features = false, features = ["derive", "migrate"] }
# Preserve the target driver's query-description support without building it on the host.
sqlx-sqlite = { version = "=0.9.0", default-features = false, features = ["offline"] }
starlark = { version = "0.14.2", default-features = false }
strum = "0.27.2"
strum_macros = "0.28.0"
+2
View File
@@ -15,6 +15,8 @@ log = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
sqlx = { workspace = true }
sqlx-macros = { workspace = true }
sqlx-sqlite = { workspace = true }
strum = { workspace = true, features = ["derive"] }
tokio = { workspace = true, features = ["fs", "io-util", "macros", "rt-multi-thread", "sync", "time"] }
tracing = { workspace = true }
+8 -7
View File
@@ -1,14 +1,15 @@
use std::borrow::Cow;
use sqlx::SqlitePool;
use sqlx::migrate::Migrator;
use sqlx_sqlite::SqlitePool;
pub(crate) static STATE_MIGRATOR: Migrator = sqlx::migrate!("./migrations");
pub(crate) static LOGS_MIGRATOR: Migrator = sqlx::migrate!("./logs_migrations");
pub(crate) static GOALS_MIGRATOR: Migrator = sqlx::migrate!("./goals_migrations");
pub(crate) static MEMORIES_MIGRATOR: Migrator = sqlx::migrate!("./memory_migrations");
pub(crate) static QUEUE_MIGRATOR: Migrator = sqlx::migrate!("./queue_migrations");
pub(crate) static THREAD_HISTORY_MIGRATOR: Migrator = sqlx::migrate!("./thread_history_migrations");
pub(crate) static STATE_MIGRATOR: Migrator = sqlx_macros::migrate!("./migrations");
pub(crate) static LOGS_MIGRATOR: Migrator = sqlx_macros::migrate!("./logs_migrations");
pub(crate) static GOALS_MIGRATOR: Migrator = sqlx_macros::migrate!("./goals_migrations");
pub(crate) static MEMORIES_MIGRATOR: Migrator = sqlx_macros::migrate!("./memory_migrations");
pub(crate) static QUEUE_MIGRATOR: Migrator = sqlx_macros::migrate!("./queue_migrations");
pub(crate) static THREAD_HISTORY_MIGRATOR: Migrator =
sqlx_macros::migrate!("./thread_history_migrations");
/// Allow an older Codex binary to open a database that has already been
/// migrated by a newer binary running in parallel.
+1 -1
View File
@@ -1,5 +1,5 @@
use serde::Serialize;
use sqlx::FromRow;
use sqlx_macros::FromRow;
#[derive(Clone, Debug, Serialize)]
pub struct LogEntry {
+1 -1
View File
@@ -441,7 +441,7 @@ WHERE cumulative_estimated_bytes <=
}
}
#[derive(sqlx::FromRow)]
#[derive(sqlx_macros::FromRow)]
struct FeedbackLogRow {
ts: i64,
ts_nanos: i64,
+1
View File
@@ -30,6 +30,7 @@ pulldown-cmark = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
sqlx = { workspace = true }
sqlx-macros = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
@@ -62,7 +62,7 @@ pub(super) struct StoredTurnRow {
pub summary_items: Vec<StoredThreadItem>,
}
#[derive(sqlx::FromRow)]
#[derive(sqlx_macros::FromRow)]
pub(super) struct StoredSummaryColumns {
summary_first_user_turn_id: Option<String>,
summary_first_user_item_id: Option<String>,