feat: add cameleer-license-minter dependency and V002 migration

Adds Ed25519 license minting library, signing_keys table,
renames tiers (LOW→STARTER, MID→TEAM, HIGH→BUSINESS, BUSINESS→ENTERPRISE),
adds label + grace_period_days to licenses, drops features column.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-26 17:17:44 +02:00
parent 883e10ba7c
commit e64bf4f0d1
2 changed files with 41 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
-- V002: License minter integration
-- Ed25519 signing keys for license minting
CREATE TABLE signing_keys (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
public_key_b64 TEXT NOT NULL,
private_key_b64 TEXT NOT NULL,
active BOOLEAN NOT NULL DEFAULT TRUE,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
-- Rename tiers: LOW→STARTER, MID→TEAM, HIGH→BUSINESS, BUSINESS→ENTERPRISE
-- Single CASE pass to avoid double-rename
UPDATE tenants SET tier = CASE tier
WHEN 'LOW' THEN 'STARTER'
WHEN 'MID' THEN 'TEAM'
WHEN 'HIGH' THEN 'BUSINESS'
WHEN 'BUSINESS' THEN 'ENTERPRISE'
ELSE tier
END WHERE tier IN ('LOW', 'MID', 'HIGH', 'BUSINESS');
UPDATE licenses SET tier = CASE tier
WHEN 'LOW' THEN 'STARTER'
WHEN 'MID' THEN 'TEAM'
WHEN 'HIGH' THEN 'BUSINESS'
WHEN 'BUSINESS' THEN 'ENTERPRISE'
ELSE tier
END WHERE tier IN ('LOW', 'MID', 'HIGH', 'BUSINESS');
-- Add new license columns for Ed25519 model
ALTER TABLE licenses ADD COLUMN label VARCHAR(255);
ALTER TABLE licenses ADD COLUMN grace_period_days INTEGER NOT NULL DEFAULT 0;
-- Drop features column (server enforces caps, not feature flags)
ALTER TABLE licenses DROP COLUMN features;