ff_backend_sqlite/queries/quota.rs
1//! Quota-family SQL โ SQLite dialect port of the quota-policy INSERT
2//! used by `create_quota_policy`. RFC-023 Phase 3.4 / RFC-020 Wave 9
3//! Standalone-1 ยง4.4.1.
4//!
5//! The `ff_quota_window` + `ff_quota_admitted` tables are defined by
6//! migration 0012 but not written on `create_quota_policy` โ they are
7//! populated by the (future) admission path. The Rev 6 "3 tables"
8//! language covers schema availability, not per-write fan-out; the PG
9//! reference (`ff-backend-postgres/src/budget.rs::create_quota_policy_impl`)
10//! writes only the policy row on create, mirrored here.
11
12pub(crate) const INSERT_QUOTA_POLICY_SQL: &str = "\
13 INSERT INTO ff_quota_policy \
14 (partition_key, quota_policy_id, requests_per_window_seconds, \
15 max_requests_per_window, active_concurrency_cap, \
16 active_concurrency, created_at_ms, updated_at_ms) \
17 VALUES (?, ?, ?, ?, ?, 0, ?, ?) \
18 ON CONFLICT (partition_key, quota_policy_id) DO NOTHING \
19 RETURNING created_at_ms";