Files
aura-crm/production/backend/migrations/067_license.sql
T
root 56ffca767d feat: offline license/trial system
7-day full-access trial, then gated behind an Ed25519-signed license key
(internal/license) verified entirely offline — no phone-home dependency.
Middleware 402s non-exempt API routes once the trial lapses with no valid
key; frontend shows a countdown banner in the last 3 days and a blocking
overlay once actually gated, both pointing at the new Settings -> Лицензия
tab. tools/gen-license mints keys for the vendor side (never ships the
private key).
2026-08-21 18:44:54 +00:00

18 lines
863 B
SQL

-- +goose Up
-- trial_started_at is stamped once, right here, at the moment this
-- migration first runs on a fresh install — i.e. the very first time this
-- app's database is created. That's what makes it a reliable "first boot"
-- timestamp without any separate first-run-detection code: goose only ever
-- runs this migration once per database, so DEFAULT NOW() here IS the
-- trial clock starting. license_key is NULL until an owner pastes one into
-- Settings; see internal/license for verification and internal/license/
-- middleware.go for what happens once the trial window closes with no
-- valid key.
ALTER TABLE settings ADD COLUMN trial_started_at TIMESTAMPTZ NOT NULL DEFAULT NOW();
ALTER TABLE settings ADD COLUMN license_key TEXT;
-- +goose Down
ALTER TABLE settings DROP COLUMN trial_started_at;
ALTER TABLE settings DROP COLUMN license_key;