Реализованы задачи бэклога 1-5 (1я не до конца)
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
"""Store raw device identifiers and add OTP verification limit.
|
||||
|
||||
Revision ID: 0004_device_otp
|
||||
Revises: 0003_consent_audit
|
||||
Create Date: 2026-07-21
|
||||
"""
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
|
||||
revision: str = "0004_device_otp"
|
||||
down_revision: str | None = "0003_consent_audit"
|
||||
branch_labels: str | Sequence[str] | None = None
|
||||
depends_on: str | Sequence[str] | None = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute(
|
||||
"""
|
||||
ALTER TABLE han_app.ux_sessions
|
||||
ADD COLUMN IF NOT EXISTS device_id varchar(255)
|
||||
"""
|
||||
)
|
||||
op.execute(
|
||||
"""
|
||||
INSERT INTO han_app.app_settings
|
||||
(setting_key, setting_value, value_type, is_public, description,
|
||||
record_status, updated_at)
|
||||
VALUES
|
||||
('otp.phone.max_verify_attempts', '5', 'integer', false,
|
||||
'Maximum failed verification attempts for one OTP challenge',
|
||||
'A', now())
|
||||
ON CONFLICT (setting_key) DO NOTHING
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
raise RuntimeError("Device and OTP limits migration is forward-only")
|
||||
Reference in New Issue
Block a user