Files
tenant-registry/migrations/0003_products.up.sql
sharang 2ea49be29d
ci / shared (push) Successful in 12s
ci / test (push) Successful in 21m58s
ci / image (push) Successful in 56s
feat(m-mig-5): products table, entitlement check, tenant ladder, per-client authz (#23)
2026-09-12 07:38:47 +00:00

50 lines
3.0 KiB
SQL

-- M-MIG-5 — product catalog moves from code into the registry.
-- launch_urls / provision_urls are keyed by environment (stage | prod).
CREATE TABLE products (
key TEXT PRIMARY KEY CHECK (key ~ '^[a-z][a-z0-9-]{1,38}$'),
name TEXT NOT NULL,
description TEXT NOT NULL DEFAULT '',
type TEXT NOT NULL CHECK (type IN ('standalone', 'headless', 'cli')),
launch_urls JSONB NOT NULL DEFAULT '{}'::jsonb,
provision_urls JSONB NOT NULL DEFAULT '{}'::jsonb,
skus JSONB NOT NULL DEFAULT '[]'::jsonb,
addons JSONB NOT NULL DEFAULT '[]'::jsonb,
plans_required TEXT[] NOT NULL DEFAULT ARRAY[]::TEXT[],
supports_trial BOOLEAN NOT NULL DEFAULT TRUE,
trial_days INT NOT NULL DEFAULT 14,
enabled BOOLEAN NOT NULL DEFAULT TRUE,
sort_order INT NOT NULL DEFAULT 100,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE TRIGGER products_touch_updated_at
BEFORE UPDATE ON products
FOR EACH ROW EXECUTE FUNCTION touch_updated_at();
-- First-line products (PLATFORM_ARCHITECTURE §2). URLs per environment.
INSERT INTO products (key, name, description, type, launch_urls, skus, addons, plans_required, supports_trial, trial_days, enabled, sort_order) VALUES
('pruefwerk', 'Prüfwerk',
'Compliance scanner for CRA / IEC 62443 style assessments: SBOM, DAST, pentest orchestration, PLC provisioning tests.',
'standalone',
'{"stage": "https://pruefwerk-stage.breakpilot.com", "prod": "https://pruefwerk.breakpilot.com"}',
'["CRA-CSA-CLD-STD", "CRA-CSA-CLD-BUS", "CRA-CSA-CLD-ENT", "CRA-CSA-CLD-SCAN"]',
'[{"id": "werkbank", "name": "Werkbank runner", "limit_key": "runners", "skus": ["CRA-WBK-CLD-STD", "CRA-WBK-CLD-BUS", "CRA-WBK-CLD-ENT"]}]',
ARRAY['standard', 'business', 'enterprise'], TRUE, 14, TRUE, 10),
('werkpilot', 'Werkpilot',
'On-prem AI coding agent for machine and plant manufacturers (CLI). Licensed per named user; talks to llm.breakpilot.com.',
'cli',
'{"stage": "https://git.breakpilot.com/platform/werkpilot/releases", "prod": "https://git.breakpilot.com/platform/werkpilot/releases"}',
'["DEV-WP-CLD-STD", "DEV-WP-CLD-BUS", "DEV-WP-CLD-ENT", "DEV-WP-OPR-STD", "DEV-WP-OPR-BUS", "DEV-WP-OPR-ENT"]',
'[]', ARRAY['standard', 'business', 'enterprise'], TRUE, 14, TRUE, 20),
('firmwerk', 'Firmwerk',
'Reproducible firmware builds with SBOM / VEX / attestation (CLI + cloud control plane).',
'cli',
'{"stage": "https://firmwerk-stage.breakpilot.com", "prod": "https://firmwerk.breakpilot.com"}',
'["DEV-FWK-CLD-STD", "DEV-FWK-CLD-BUS", "DEV-FWK-CLD-ENT", "DEV-FWK-OPR-STD", "DEV-FWK-OPR-BUS", "DEV-FWK-OPR-ENT"]',
'[]', ARRAY['standard', 'business', 'enterprise'], TRUE, 14, TRUE, 30),
-- breakpilot-compliance (dsms) is re-enabled when it migrates to the platform cluster (M-MIG-9).
('compliance', 'Compliance',
'DSFA / TOM / VVT generation; evidence capture.',
'standalone', '{}', '[]', '[]', ARRAY['standard', 'business', 'enterprise'], TRUE, 14, FALSE, 90);