iOS6.1.6.sql 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. );
  47. CREATE TABLE sqlite_sequence(
  48. name,
  49. seq
  50. );
  51. CREATE TABLE chat (
  52. ROWID INTEGER PRIMARY KEY AUTOINCREMENT,
  53. guid TEXT UNIQUE NOT NULL,
  54. style INTEGER,
  55. state INTEGER,
  56. account_id TEXT,
  57. properties BLOB,
  58. chat_identifier TEXT,
  59. service_name TEXT,
  60. room_name TEXT,
  61. account_login TEXT,
  62. is_archived INTEGER DEFAULT 0,
  63. last_addressed_handle TEXT
  64. );
  65. CREATE TABLE attachment (
  66. ROWID INTEGER PRIMARY KEY AUTOINCREMENT,
  67. guid TEXT UNIQUE NOT NULL,
  68. created_date INTEGER DEFAULT 0,
  69. start_date INTEGER DEFAULT 0,
  70. filename TEXT,
  71. uti TEXT,
  72. mime_type TEXT,
  73. transfer_state INTEGER DEFAULT 0,
  74. is_outgoing INTEGER DEFAULT 0
  75. );
  76. CREATE TABLE handle (
  77. ROWID INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,
  78. id TEXT NOT NULL,
  79. country TEXT,
  80. service TEXT NOT NULL,
  81. uncanonicalized_id TEXT,
  82. UNIQUE (id, service)
  83. );
  84. CREATE TABLE message_attachment_join (
  85. message_id INTEGER REFERENCES message (ROWID) ON DELETE CASCADE,
  86. attachment_id INTEGER REFERENCES attachment (ROWID) ON DELETE CASCADE,
  87. UNIQUE(message_id, attachment_id)
  88. );
  89. CREATE TABLE chat_handle_join (
  90. chat_id INTEGER REFERENCES chat (ROWID) ON DELETE CASCADE,
  91. handle_id INTEGER REFERENCES handle (ROWID) ON DELETE CASCADE,
  92. UNIQUE(chat_id, handle_id)
  93. );
  94. CREATE TABLE chat_message_join (
  95. chat_id INTEGER REFERENCES chat (ROWID) ON DELETE CASCADE,
  96. message_id INTEGER REFERENCES message (ROWID) ON DELETE CASCADE,
  97. PRIMARY KEY (chat_id, message_id)
  98. );