iOS10.2.sql 4.0 KB

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