webhistory_11.2.sql 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. CREATE TABLE history_items (
  2. id INTEGER PRIMARY KEY AUTOINCREMENT,
  3. url TEXT NOT NULL UNIQUE,
  4. domain_expansion TEXT NULL,
  5. visit_count INTEGER NOT NULL,
  6. daily_visit_counts BLOB NOT NULL,
  7. weekly_visit_counts BLOB NULL,
  8. autocomplete_triggers BLOB NULL,
  9. should_recompute_derived_visit_counts INTEGER NOT NULL,
  10. visit_count_score INTEGER NOT NULL);
  11. CREATE TABLE sqlite_sequence(name, seq);
  12. CREATE TABLE history_visits (
  13. id INTEGER PRIMARY KEY AUTOINCREMENT,
  14. history_item INTEGER NOT NULL REFERENCES history_items(id) ON DELETE CASCADE,
  15. visit_time REAL NOT NULL,
  16. title TEXT NULL,
  17. load_successful BOOLEAN NOT NULL DEFAULT 1,
  18. http_non_get BOOLEAN NOT NULL DEFAULT 0,
  19. synthesized BOOLEAN NOT NULL DEFAULT 0,
  20. redirect_source INTEGER NULL UNIQUE REFERENCES history_visits(id) ON DELETE CASCADE,
  21. redirect_destination INTEGER NULL UNIQUE REFERENCES history_visits(id) ON DELETE CASCADE,
  22. origin INTEGER NOT NULL DEFAULT 0,
  23. generation INTEGER NOT NULL DEFAULT 0,
  24. attributes INTEGER NOT NULL DEFAULT 0,
  25. score INTEGER NOT NULL DEFAULT 0);
  26. CREATE TABLE history_tombstones (
  27. id INTEGER PRIMARY KEY AUTOINCREMENT,
  28. start_time REAL NOT NULL,
  29. end_time REAL NOT NULL,
  30. url TEXT,
  31. generation INTEGER NOT NULL DEFAULT 0);
  32. CREATE TABLE metadata (
  33. key TEXT NOT NULL UNIQUE,
  34. value);
  35. CREATE TABLE history_client_versions (
  36. client_version INTEGER PRIMARY KEY,
  37. last_seen REAL NOT NULL);
  38. CREATE TABLE history_event_listeners (
  39. listener_name TEXT PRIMARY KEY NOT NULL UNIQUE,
  40. last_seen REAL NOT NULL);
  41. CREATE TABLE history_events (
  42. id INTEGER PRIMARY KEY AUTOINCREMENT,
  43. event_type TEXT NOT NULL,
  44. event_time REAL NOT NULL,
  45. pending_listeners TEXT NOT NULL,
  46. value BLOB);
  47. CREATE INDEX history_items__domain_expansion ON history_items (domain_expansion);
  48. CREATE INDEX history_visits__last_visit ON history_visits (history_item, visit_time DESC, synthesized ASC);
  49. CREATE INDEX history_visits__origin ON history_visits (origin, generation);
  50. CREATE INDEX history_tombstones__generation ON history_tombstones (generation);
  51. CREATE INDEX history_tombstones__end_time ON history_tombstones (end_time);