mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-13 04:51:00 +08:00
* refactor(server): unify policy persistence in objects table Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com> * fix(server): clean sandbox-owned records on reconcile delete * refactor(server): use protos for stored policy records * refactor(server): move policy persistence into policy_store * fix(server): restore compute runtime merge compatibility * fix(server): validate draft chunk sandbox ownership --------- Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>
30 lines
915 B
SQL
30 lines
915 B
SQL
CREATE TABLE IF NOT EXISTS objects (
|
|
id TEXT PRIMARY KEY,
|
|
object_type TEXT NOT NULL,
|
|
name TEXT,
|
|
scope TEXT,
|
|
version INTEGER,
|
|
status TEXT,
|
|
dedup_key TEXT,
|
|
hit_count INTEGER NOT NULL DEFAULT 0,
|
|
payload BLOB NOT NULL,
|
|
created_at_ms INTEGER NOT NULL,
|
|
updated_at_ms INTEGER NOT NULL
|
|
);
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS objects_name_uq
|
|
ON objects (object_type, name)
|
|
WHERE name IS NOT NULL;
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS objects_version_uq
|
|
ON objects (object_type, scope, version)
|
|
WHERE scope IS NOT NULL AND version IS NOT NULL;
|
|
|
|
CREATE INDEX IF NOT EXISTS objects_scope_status_idx
|
|
ON objects (object_type, scope, status, version)
|
|
WHERE scope IS NOT NULL;
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS objects_dedup_uq
|
|
ON objects (object_type, scope, dedup_key)
|
|
WHERE dedup_key IS NOT NULL;
|