Bug 1850713: remove duplicated setting of early hint preloader id in `ScriptLoader...
[gecko.git] / dom / indexedDB / DBSchema.h
blob0c0a0d9850ea41a21cbaa6d020d84a0125cd9f43
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef dom_indexeddb_dbschema_h__
8 #define dom_indexeddb_dbschema_h__
10 #include "ErrorList.h"
12 #include <cstdint>
14 class mozIStorageConnection;
16 namespace mozilla::dom::indexedDB {
18 // Major schema version. Bump for almost everything.
19 const uint32_t kMajorSchemaVersion = 26;
21 // Minor schema version. Should almost always be 0 (maybe bump on release
22 // branches if we have to).
23 const uint32_t kMinorSchemaVersion = 0;
25 // The schema version we store in the SQLite database is a (signed) 32-bit
26 // integer. The major version is left-shifted 4 bits so the max value is
27 // 0xFFFFFFF. The minor version occupies the lower 4 bits and its max is 0xF.
28 static_assert(kMajorSchemaVersion <= 0xFFFFFFF,
29 "Major version needs to fit in 28 bits.");
30 static_assert(kMinorSchemaVersion <= 0xF,
31 "Minor version needs to fit in 4 bits.");
33 constexpr int32_t MakeSchemaVersion(uint32_t aMajorSchemaVersion,
34 uint32_t aMinorSchemaVersion) {
35 return int32_t((aMajorSchemaVersion << 4) + aMinorSchemaVersion);
38 constexpr int32_t kSQLiteSchemaVersion =
39 MakeSchemaVersion(kMajorSchemaVersion, kMinorSchemaVersion);
41 nsresult CreateFileTables(mozIStorageConnection& aConnection);
42 nsresult CreateTables(mozIStorageConnection& aConnection);
44 } // namespace mozilla::dom::indexedDB
46 #endif