1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ : 3 * This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef nsPlacesIndexes_h__ 8 #define nsPlacesIndexes_h__ 9 10 #define CREATE_PLACES_IDX(__name, __table, __columns, __type) \ 11 nsLiteralCString("CREATE " __type " INDEX IF NOT EXISTS " __table "_" __name \ 12 " ON " __table " (" __columns ")") 13 14 /** 15 * moz_places 16 */ 17 #define CREATE_IDX_MOZ_PLACES_URL_HASH \ 18 CREATE_PLACES_IDX("url_hashindex", "moz_places", "url_hash", "") 19 20 #define CREATE_IDX_MOZ_PLACES_REVHOST \ 21 CREATE_PLACES_IDX("hostindex", "moz_places", "rev_host", "") 22 23 #define CREATE_IDX_MOZ_PLACES_VISITCOUNT \ 24 CREATE_PLACES_IDX("visitcount", "moz_places", "visit_count", "") 25 26 #define CREATE_IDX_MOZ_PLACES_FRECENCY \ 27 CREATE_PLACES_IDX("frecencyindex", "moz_places", "frecency", "") 28 29 #define CREATE_IDX_MOZ_PLACES_LASTVISITDATE \ 30 CREATE_PLACES_IDX("lastvisitdateindex", "moz_places", "last_visit_date", "") 31 32 #define CREATE_IDX_MOZ_PLACES_GUID \ 33 CREATE_PLACES_IDX("guid_uniqueindex", "moz_places", "guid", "UNIQUE") 34 35 #define CREATE_IDX_MOZ_PLACES_ORIGIN_ID \ 36 CREATE_PLACES_IDX("originidindex", "moz_places", "origin_id", "") 37 38 /** 39 * moz_historyvisits 40 */ 41 42 #define CREATE_IDX_MOZ_HISTORYVISITS_PLACEDATE \ 43 CREATE_PLACES_IDX("placedateindex", "moz_historyvisits", \ 44 "place_id, visit_date", "") 45 46 #define CREATE_IDX_MOZ_HISTORYVISITS_FROMVISIT \ 47 CREATE_PLACES_IDX("fromindex", "moz_historyvisits", "from_visit", "") 48 49 #define CREATE_IDX_MOZ_HISTORYVISITS_VISITDATE \ 50 CREATE_PLACES_IDX("dateindex", "moz_historyvisits", "visit_date", "") 51 52 /** 53 * moz_bookmarks 54 */ 55 56 #define CREATE_IDX_MOZ_BOOKMARKS_PLACETYPE \ 57 CREATE_PLACES_IDX("itemindex", "moz_bookmarks", "fk, type", "") 58 59 #define CREATE_IDX_MOZ_BOOKMARKS_PARENTPOSITION \ 60 CREATE_PLACES_IDX("parentindex", "moz_bookmarks", "parent, position", "") 61 62 #define CREATE_IDX_MOZ_BOOKMARKS_PLACELASTMODIFIED \ 63 CREATE_PLACES_IDX("itemlastmodifiedindex", "moz_bookmarks", \ 64 "fk, lastModified", "") 65 66 #define CREATE_IDX_MOZ_BOOKMARKS_DATEADDED \ 67 CREATE_PLACES_IDX("dateaddedindex", "moz_bookmarks", "dateAdded", "") 68 69 #define CREATE_IDX_MOZ_BOOKMARKS_GUID \ 70 CREATE_PLACES_IDX("guid_uniqueindex", "moz_bookmarks", "guid", "UNIQUE") 71 72 /** 73 * moz_annos 74 */ 75 76 #define CREATE_IDX_MOZ_ANNOS_PLACEATTRIBUTE \ 77 CREATE_PLACES_IDX("placeattributeindex", "moz_annos", \ 78 "place_id, anno_attribute_id", "UNIQUE") 79 80 /** 81 * moz_items_annos 82 */ 83 84 #define CREATE_IDX_MOZ_ITEMSANNOS_PLACEATTRIBUTE \ 85 CREATE_PLACES_IDX("itemattributeindex", "moz_items_annos", \ 86 "item_id, anno_attribute_id", "UNIQUE") 87 88 /** 89 * moz_keywords 90 */ 91 92 #define CREATE_IDX_MOZ_KEYWORDS_PLACEPOSTDATA \ 93 CREATE_PLACES_IDX("placepostdata_uniqueindex", "moz_keywords", \ 94 "place_id, post_data", "UNIQUE") 95 96 // moz_pages_w_icons 97 98 #define CREATE_IDX_MOZ_PAGES_W_ICONS_ICONURLHASH \ 99 CREATE_PLACES_IDX("urlhashindex", "moz_pages_w_icons", "page_url_hash", "") 100 101 // moz_icons 102 103 #define CREATE_IDX_MOZ_ICONS_ICONURLHASH \ 104 CREATE_PLACES_IDX("iconurlhashindex", "moz_icons", "fixed_icon_url_hash", "") 105 106 // moz_places_metadata 107 #define CREATE_IDX_MOZ_PLACES_METADATA_PLACECREATED \ 108 CREATE_PLACES_IDX("placecreated_uniqueindex", "moz_places_metadata", \ 109 "place_id, created_at", "UNIQUE") 110 111 #define CREATE_IDX_MOZ_PLACES_METADATA_REFERRER \ 112 CREATE_PLACES_IDX("referrerindex", "moz_places_metadata", \ 113 "referrer_place_id", "") 114 115 // moz_places_metadata_snapshots 116 #define CREATE_IDX_MOZ_PLACES_METADATA_SNAPSHOTS_PINNNED \ 117 CREATE_PLACES_IDX("pinnedindex", "moz_places_metadata_snapshots", \ 118 "user_persisted, last_interaction_at", "") 119 120 // moz_places_metadata_snapshots_extra 121 #define CREATE_IDX_MOZ_PLACES_METADATA_SNAPSHOTS_EXTRA_TYPE \ 122 CREATE_PLACES_IDX("typeindex", "moz_places_metadata_snapshots_extra", \ 123 "type", "") 124 125 #endif // nsPlacesIndexes_h__ 126