Skip to content

@xtandard/entitlements/drizzle/mysql

MySQL Drizzle table factories: mysqlEntitlementsTable() (state KV) and mysqlCountersTable() (counters), with binary-collated keys. Schema-only.

import { … } from "@xtandard/entitlements/drizzle/mysql";
Name Summary
mysqlCountersTable Build the MySQL mysqlTable for the counter store: key varchar … COLLATE utf8mb4_bin PRIMARY KEY, value double NOT NULL DEFAULT 0, applied double NOT NULL DEFAULT 0, expires_at bigint (unix ms). The table name defaults to "xtandard_entitlements_counters".
mysqlEntitlementsTable Build the MySQL mysqlTable for the entitlements KV store: key varchar … COLLATE utf8mb4_bin PRIMARY KEY, value json NOT NULL. The table name defaults to "xtandard_entitlements_kv".
Name Summary
MysqlCountersTableOptions Options for mysqlCountersTable (same knobs as the KV table).
MysqlEntitlementsTableOptions Options for mysqlEntitlementsTable and mysqlCountersTable: keyLength (default 512), keyCollation (default "utf8mb4_bin"; pass "utf8mb4_0900_bin" on MySQL 8.0+ or "utf8mb4_nopad_bin" on MariaDB for a NO PAD key), extraColumns and extraIndexes.
Name Documented on
DrizzleCounterTable @xtandard/entitlements/counters/drizzle