iOS9.2.1.sql 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. -- Tables
  2. CREATE TABLE _SqliteDatabaseProperties (
  3. key TEXT,
  4. value TEXT,
  5. UNIQUE(key)
  6. );
  7. CREATE TABLE message (
  8. ROWID INTEGER PRIMARY KEY AUTOINCREMENT,
  9. guid TEXT UNIQUE NOT NULL,
  10. text TEXT,
  11. replace INTEGER DEFAULT 0,
  12. service_center TEXT,
  13. handle_id INTEGER DEFAULT 0,
  14. subject TEXT,
  15. country TEXT,
  16. attributedBody BLOB,
  17. version INTEGER DEFAULT 0,
  18. type INTEGER DEFAULT 0,
  19. service TEXT,
  20. account TEXT,
  21. account_guid TEXT,
  22. error INTEGER DEFAULT 0,
  23. date INTEGER,
  24. date_read INTEGER,
  25. date_delivered INTEGER,
  26. is_delivered INTEGER DEFAULT 0,
  27. is_finished INTEGER DEFAULT 0,
  28. is_emote INTEGER DEFAULT 0,
  29. is_from_me INTEGER DEFAULT 0,
  30. is_empty INTEGER DEFAULT 0,
  31. is_delayed INTEGER DEFAULT 0,
  32. is_auto_reply INTEGER DEFAULT 0,
  33. is_prepared INTEGER DEFAULT 0,
  34. is_read INTEGER DEFAULT 0,
  35. is_system_message INTEGER DEFAULT 0,
  36. is_sent INTEGER DEFAULT 0,
  37. has_dd_results INTEGER DEFAULT 0,
  38. is_service_message INTEGER DEFAULT 0,
  39. is_forward INTEGER DEFAULT 0,
  40. was_downgraded INTEGER DEFAULT 0,
  41. is_archive INTEGER DEFAULT 0,
  42. cache_has_attachments INTEGER DEFAULT 0,
  43. cache_roomnames TEXT,
  44. was_data_detected INTEGER DEFAULT 0,
  45. was_deduplicated INTEGER DEFAULT 0,
  46. is_audio_message INTEGER DEFAULT 0,
  47. is_played INTEGER DEFAULT 0,
  48. date_played INTEGER,
  49. item_type INTEGER DEFAULT 0,
  50. other_handle INTEGER DEFAULT 0,
  51. group_title TEXT,
  52. group_action_type INTEGER DEFAULT 0,
  53. share_status INTEGER DEFAULT 0,
  54. share_direction INTEGER DEFAULT 0,
  55. is_expirable INTEGER DEFAULT 0,
  56. expire_state INTEGER DEFAULT 0,
  57. message_action_type INTEGER DEFAULT 0,
  58. message_source INTEGER DEFAULT 0
  59. );
  60. CREATE TABLE sqlite_sequence(name, seq);
  61. CREATE TABLE chat (
  62. ROWID INTEGER PRIMARY KEY AUTOINCREMENT,
  63. guid TEXT UNIQUE NOT NULL,
  64. style INTEGER,
  65. state INTEGER,
  66. account_id TEXT,
  67. properties BLOB,
  68. chat_identifier TEXT,
  69. service_name TEXT,
  70. room_name TEXT,
  71. account_login TEXT,
  72. is_archived INTEGER DEFAULT 0,
  73. last_addressed_handle TEXT,
  74. display_name TEXT,
  75. group_id TEXT,
  76. is_filtered INTEGER DEFAULT 0,
  77. successful_query INTEGER DEFAULT 1
  78. );
  79. CREATE TABLE attachment (
  80. ROWID INTEGER PRIMARY KEY AUTOINCREMENT,
  81. guid TEXT UNIQUE NOT NULL,
  82. created_date INTEGER DEFAULT 0,
  83. start_date INTEGER DEFAULT 0,
  84. filename TEXT,
  85. uti TEXT,
  86. mime_type TEXT,
  87. transfer_state INTEGER DEFAULT 0,
  88. is_outgoing INTEGER DEFAULT 0,
  89. user_info BLOB,
  90. transfer_name TEXT,
  91. total_bytes INTEGER DEFAULT 0
  92. );
  93. CREATE TABLE handle (
  94. ROWID INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,
  95. id TEXT NOT NULL,
  96. country TEXT,
  97. service TEXT NOT NULL,
  98. uncanonicalized_id TEXT,
  99. UNIQUE (id, service)
  100. );
  101. CREATE TABLE message_attachment_join (
  102. message_id INTEGER REFERENCES message (ROWID) ON DELETE CASCADE,
  103. attachment_id INTEGER REFERENCES attachment (ROWID) ON DELETE CASCADE,
  104. UNIQUE(message_id, attachment_id)
  105. );
  106. CREATE TABLE chat_handle_join (
  107. chat_id INTEGER REFERENCES chat (ROWID) ON DELETE CASCADE,
  108. handle_id INTEGER REFERENCES handle (ROWID) ON DELETE CASCADE,
  109. UNIQUE(chat_id, handle_id)
  110. );
  111. CREATE TABLE chat_message_join (
  112. chat_id INTEGER REFERENCES chat (ROWID) ON DELETE CASCADE,
  113. message_id INTEGER REFERENCES message (ROWID) ON DELETE CASCADE,
  114. PRIMARY KEY (chat_id, message_id)
  115. );
  116. CREATE TABLE deleted_messages (
  117. ROWID INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,
  118. guid TEXT NOT NULL
  119. );