github.com/status-im/status-go@v1.1.0/protocol/migrations/sqlite/1674210659_add_contact_request_local_clock.up.sql (about)

     1  
     2  ALTER TABLE contacts ADD COLUMN contact_request_local_clock INT;
     3  ALTER TABLE contacts ADD COLUMN contact_request_remote_clock INT;
     4  ALTER TABLE contacts ADD COLUMN contact_request_remote_state INT;
     5  
     6  -- Broken migration, leaving for posterity and eternal embarrassment
     7  -- but hey, on the bright side, this is valid sql
     8  UPDATE contacts SET contact_request_state = CASE
     9      WHEN added THEN
    10        contact_request_state = 2
    11    END;
    12  
    13  UPDATE contacts SET contact_request_local_clock = last_updated_locally;
    14  
    15  -- Broken migration, leaving for posterity and eternal embarrassment
    16  UPDATE contacts SET contact_request_remote_state = CASE
    17      WHEN has_added_us THEN
    18        contact_request_state = 3
    19    END;