app

Local-first trade for farms and co-ops
git clone https://radroots.dev/git/app.git
Log | Files | Refs | README | LICENSE

0028_sdk_migration_receipts.sql (1086B)


      1 CREATE TABLE app_sdk_migration_receipts (
      2     id TEXT PRIMARY KEY NOT NULL,
      3     source_kind TEXT NOT NULL CHECK (
      4         source_kind IN ('local_outbox', 'shared_local_event')
      5     ),
      6     source_record_id TEXT NOT NULL,
      7     sdk_operation_kind TEXT NOT NULL,
      8     sdk_outbox_event_ids_json TEXT NOT NULL,
      9     expected_event_id TEXT,
     10     actor_pubkey TEXT,
     11     idempotency_digest_prefix TEXT,
     12     migration_state TEXT NOT NULL CHECK (
     13         migration_state IN (
     14             'pending',
     15             'prepared',
     16             'enqueued',
     17             'pushed',
     18             'failed',
     19             'blocked',
     20             'skipped',
     21             'unsupported',
     22             'manual_review',
     23             'unknown'
     24         )
     25     ),
     26     created_at TEXT NOT NULL,
     27     updated_at TEXT NOT NULL,
     28     detail_json TEXT NOT NULL,
     29     UNIQUE(source_kind, source_record_id)
     30 );
     31 
     32 CREATE INDEX idx_app_sdk_migration_receipts_source_record ON app_sdk_migration_receipts(
     33     source_record_id
     34 );
     35 CREATE INDEX idx_app_sdk_migration_receipts_state ON app_sdk_migration_receipts(
     36     migration_state,
     37     updated_at
     38 );