1 #pragma once 2 3 // THIS IS A GENERATED FILE; EDIT offline_schema.sql INSTEAD 4 // To regenerate, run `node platform/default/mbgl/storage/offline_schema.js` 5 6 namespace mbgl { 7 8 static constexpr const char* offlineDatabaseSchema = 9 "CREATE TABLE resources (\n" 10 " id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n" 11 " url TEXT NOT NULL,\n" 12 " kind INTEGER NOT NULL,\n" 13 " expires INTEGER,\n" 14 " modified INTEGER,\n" 15 " etag TEXT,\n" 16 " data BLOB,\n" 17 " compressed INTEGER NOT NULL DEFAULT 0,\n" 18 " accessed INTEGER NOT NULL,\n" 19 " must_revalidate INTEGER NOT NULL DEFAULT 0,\n" 20 " UNIQUE (url)\n" 21 ");\n" 22 "CREATE TABLE tiles (\n" 23 " id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n" 24 " url_template TEXT NOT NULL,\n" 25 " pixel_ratio INTEGER NOT NULL,\n" 26 " z INTEGER NOT NULL,\n" 27 " x INTEGER NOT NULL,\n" 28 " y INTEGER NOT NULL,\n" 29 " expires INTEGER,\n" 30 " modified INTEGER,\n" 31 " etag TEXT,\n" 32 " data BLOB,\n" 33 " compressed INTEGER NOT NULL DEFAULT 0,\n" 34 " accessed INTEGER NOT NULL,\n" 35 " must_revalidate INTEGER NOT NULL DEFAULT 0,\n" 36 " UNIQUE (url_template, pixel_ratio, z, x, y)\n" 37 ");\n" 38 "CREATE TABLE regions (\n" 39 " id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n" 40 " definition TEXT NOT NULL,\n" 41 " description BLOB\n" 42 ");\n" 43 "CREATE TABLE region_resources (\n" 44 " region_id INTEGER NOT NULL REFERENCES regions(id) ON DELETE CASCADE,\n" 45 " resource_id INTEGER NOT NULL REFERENCES resources(id),\n" 46 " UNIQUE (region_id, resource_id)\n" 47 ");\n" 48 "CREATE TABLE region_tiles (\n" 49 " region_id INTEGER NOT NULL REFERENCES regions(id) ON DELETE CASCADE,\n" 50 " tile_id INTEGER NOT NULL REFERENCES tiles(id),\n" 51 " UNIQUE (region_id, tile_id)\n" 52 ");\n" 53 "CREATE INDEX resources_accessed\n" 54 "ON resources (accessed);\n" 55 "CREATE INDEX tiles_accessed\n" 56 "ON tiles (accessed);\n" 57 "CREATE INDEX region_resources_resource_id\n" 58 "ON region_resources (resource_id);\n" 59 "CREATE INDEX region_tiles_tile_id\n" 60 "ON region_tiles (tile_id);\n" 61 ; 62 63 } // namespace mbgl 64