pub const CREATE_RUNLIMIT_FIXED_WINDOWS_SQL: &str = "-- Runlimit\'s fixed windows are anchored to the first admitted check. PostgreSQL\n-- is the time authority; applications must not write this table directly.\nCREATE TABLE runlimit_fixed_windows (\n policy_id TEXT NOT NULL,\n scope_id TEXT NOT NULL,\n config_fingerprint BYTEA NOT NULL,\n subject_key BYTEA NOT NULL,\n window_started_at TIMESTAMPTZ NOT NULL,\n window_expires_at TIMESTAMPTZ NOT NULL,\n used BIGINT NOT NULL,\n PRIMARY KEY (config_fingerprint, subject_key),\n CONSTRAINT runlimit_fixed_windows_policy_id_size\n CHECK (octet_length(policy_id) BETWEEN 1 AND 128),\n CONSTRAINT runlimit_fixed_windows_scope_id_size\n CHECK (octet_length(scope_id) BETWEEN 1 AND 128),\n CONSTRAINT runlimit_fixed_windows_fingerprint_size\n CHECK (octet_length(config_fingerprint) = 32),\n CONSTRAINT runlimit_fixed_windows_subject_key_size\n CHECK (octet_length(subject_key) = 32),\n CONSTRAINT runlimit_fixed_windows_valid_window\n CHECK (window_expires_at > window_started_at),\n CONSTRAINT runlimit_fixed_windows_positive_usage\n CHECK (used > 0)\n);\n\nCREATE INDEX runlimit_fixed_windows_expiry_idx\n ON runlimit_fixed_windows (window_expires_at);\n";Expand description
SQL for the immutable 20260723000000_create_runlimit_fixed_windows
migration.
Strict host migrators can copy this SQL into their application-owned
migration stream instead of running MIGRATOR against a shared
_sqlx_migrations history. Apply it before
SET_RUNLIMIT_FIXED_WINDOWS_FILLFACTOR_SQL.