Files
story/migrations/000052_device_factory_reset.up.sql
Codex Local 0c2151ace9
ci / verify (push) Canceled after 0s
chore: checkpoint 第一版
2026-09-06 17:04:11 +08:00

18 lines
716 B
PL/PgSQL

BEGIN;
ALTER TABLE device
ADD COLUMN factory_reset_counter bigint NOT NULL DEFAULT 0
CHECK (factory_reset_counter >= 0);
COMMENT ON COLUMN device.factory_reset_counter IS
'Monotonic counter supplied by the physical device for authenticated factory-reset replay protection.';
ALTER TABLE web_event DROP CONSTRAINT web_event_event_type_check;
ALTER TABLE web_event ADD CONSTRAINT web_event_event_type_check CHECK (event_type IN (
'device.presence.changed','device.binding.reset',
'conversation.started','conversation.completed','conversation.failed',
'story.created','story.revised','media.upload.completed','export.ready',
'privacy_request.updated','device.command.updated'));
COMMIT;