const CREATE_SCHEMA_SQL: &str = "-- This Source Code Form is subject to the terms of the Mozilla Public\n-- License, v. 2.0. If a copy of the MPL was not distributed with this\n-- file, You can obtain one at http://mozilla.org/MPL/2.0/.\n\n-- This is a very simple schema for a chrome.storage.* implementation. At time\n-- of writing, only chrome.storage.sync is supported, but this can be trivially\n-- enhanced to support chrome.storage.local (the api is identical, it\'s just a\n-- different \"bucket\" and doesn\'t sync).\n--\n-- Even though the spec allows for a single extension to have any number of\n-- \"keys\", we\'ve made the decision to store all keys for a given extension in a\n-- single row as a JSON representation of all keys and values.\n-- We\'ve done this primarily due to:\n-- * The shape of the API is very JSON, and it almost encourages multiple keys\n-- to be fetched at one time.\n-- * The defined max sizes that extensions are allowed to store using this API\n-- is sufficiently small that we don\'t have many concerns around record sizes.\n-- * We\'d strongly prefer to keep one record per extension when syncing this\n-- data, so having the local store in this shape makes syncing easier.\n\nCREATE TABLE IF NOT EXISTS storage_sync_data (\n ext_id TEXT NOT NULL PRIMARY KEY,\n\n /* The JSON payload. NULL means it\'s a tombstone */\n data TEXT,\n\n /* Same \"sync change counter\" strategy used by other components. */\n sync_change_counter INTEGER NOT NULL DEFAULT 1\n);\n\nCREATE TABLE IF NOT EXISTS storage_sync_mirror (\n guid TEXT NOT NULL PRIMARY KEY,\n\n /* The extension_id is explicitly not the GUID used on the server.\n It can\'t be a regular foreign-key relationship back to storage_sync_data\n as items with no data on the server (ie, deleted items) will not appear\n in storage_sync_data, and the guid isn\'t in that table either.\n It must allow NULL as tombstones do not carry the ext_id, so we have\n an additional CHECK constraint.\n */\n ext_id TEXT UNIQUE,\n\n /* The JSON payload. We *do* allow NULL here - it means \"deleted\" */\n data TEXT\n\n /* tombstones have no ext_id and no data. Non tombstones must have both */\n CHECK((ext_id IS NULL AND data IS NULL) OR (ext_id IS NOT NULL AND data IS NOT NULL))\n);\n\n-- This table holds key-value metadata - primarily for sync.\nCREATE TABLE IF NOT EXISTS meta (\n key TEXT PRIMARY KEY,\n value NOT NULL\n) WITHOUT ROWID;\n";