fix tests. new product advisories enhancements

This commit is contained in:
master
2026-01-25 19:11:36 +02:00
parent c70e83719e
commit 6e687b523a
504 changed files with 40610 additions and 3785 deletions

View File

@@ -0,0 +1,88 @@
-- Graph Indexer Schema Migration 001: Initial Schema
-- Creates the graph indexer schema for nodes, edges, snapshots, analytics, and idempotency
-- ============================================================================
-- Graph Nodes
-- ============================================================================
CREATE TABLE IF NOT EXISTS graph_nodes (
id TEXT PRIMARY KEY,
tenant_id TEXT NOT NULL,
node_type TEXT NOT NULL,
data JSONB NOT NULL DEFAULT '{}'::jsonb,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_graph_nodes_tenant ON graph_nodes (tenant_id);
CREATE INDEX IF NOT EXISTS idx_graph_nodes_type ON graph_nodes (node_type);
CREATE INDEX IF NOT EXISTS idx_graph_nodes_created_at ON graph_nodes (created_at);
-- ============================================================================
-- Graph Edges
-- ============================================================================
CREATE TABLE IF NOT EXISTS graph_edges (
id TEXT PRIMARY KEY,
tenant_id TEXT NOT NULL,
source_id TEXT NOT NULL,
target_id TEXT NOT NULL,
edge_type TEXT NOT NULL,
data JSONB NOT NULL DEFAULT '{}'::jsonb,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_graph_edges_tenant ON graph_edges (tenant_id);
CREATE INDEX IF NOT EXISTS idx_graph_edges_source ON graph_edges (source_id);
CREATE INDEX IF NOT EXISTS idx_graph_edges_target ON graph_edges (target_id);
CREATE INDEX IF NOT EXISTS idx_graph_edges_type ON graph_edges (edge_type);
CREATE INDEX IF NOT EXISTS idx_graph_edges_created_at ON graph_edges (created_at);
-- ============================================================================
-- Graph Snapshots
-- ============================================================================
CREATE TABLE IF NOT EXISTS graph_snapshots (
id TEXT PRIMARY KEY,
tenant_id TEXT NOT NULL,
snapshot_id TEXT NOT NULL,
generated_at TIMESTAMPTZ NOT NULL,
node_count INTEGER NOT NULL DEFAULT 0,
edge_count INTEGER NOT NULL DEFAULT 0,
metadata JSONB NOT NULL DEFAULT '{}'::jsonb,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
UNIQUE (tenant_id, snapshot_id)
);
CREATE INDEX IF NOT EXISTS idx_graph_snapshots_tenant ON graph_snapshots (tenant_id);
CREATE INDEX IF NOT EXISTS idx_graph_snapshots_generated_at ON graph_snapshots (generated_at);
-- ============================================================================
-- Graph Analytics
-- ============================================================================
CREATE TABLE IF NOT EXISTS graph_analytics (
id TEXT PRIMARY KEY,
tenant_id TEXT NOT NULL,
snapshot_id TEXT NOT NULL,
metric_type TEXT NOT NULL,
node_id TEXT,
value DOUBLE PRECISION NOT NULL,
metadata JSONB NOT NULL DEFAULT '{}'::jsonb,
computed_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_graph_analytics_tenant ON graph_analytics (tenant_id);
CREATE INDEX IF NOT EXISTS idx_graph_analytics_snapshot ON graph_analytics (snapshot_id);
CREATE INDEX IF NOT EXISTS idx_graph_analytics_metric ON graph_analytics (metric_type);
CREATE INDEX IF NOT EXISTS idx_graph_analytics_computed_at ON graph_analytics (computed_at);
-- ============================================================================
-- Graph Idempotency
-- ============================================================================
CREATE TABLE IF NOT EXISTS graph_idempotency (
sequence_token TEXT PRIMARY KEY,
seen_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_graph_idempotency_seen_at ON graph_idempotency (seen_at);

View File

@@ -10,6 +10,10 @@
<Description>Consolidated persistence layer for StellaOps Graph Indexer module</Description>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Migrations\*.sql" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" PrivateAssets="all" />