Interface.h (2130B)
1 // Copyright (c) Microsoft Corporation. 2 // Licensed under the MIT License. 3 #pragma once 4 #include "Microsoft/Schema/ISQLiteIndex.h" 5 #include "Microsoft/Schema/1_3/Interface.h" 6 7 namespace AppInstaller::Repository::Microsoft::Schema::V1_4 8 { 9 // Interface to this schema version exposed through ISQLiteIndex. 10 struct Interface : public V1_3::Interface 11 { 12 Interface(Utility::NormalizationVersion normVersion = Utility::NormalizationVersion::Initial); 13 14 // Version 1.0 15 SQLite::Version GetVersion() const override; 16 void CreateTables(SQLite::Connection& connection, CreateOptions options) override; 17 SQLite::rowid_t AddManifest(SQLite::Connection& connection, const Manifest::Manifest& manifest, const std::optional<std::filesystem::path>& relativePath) override; 18 std::pair<bool, SQLite::rowid_t> UpdateManifest(SQLite::Connection& connection, const Manifest::Manifest& manifest, const std::optional<std::filesystem::path>& relativePath) override; 19 void RemoveManifestById(SQLite::Connection& connection, SQLite::rowid_t manifestId) override; 20 bool CheckConsistency(const SQLite::Connection& connection, bool log) const override; 21 void PrepareForPackaging(SQLite::Connection& connection, bool vacuum) override; 22 23 std::set<std::pair<SQLite::rowid_t, Utility::NormalizedString>> GetDependenciesByManifestRowId(const SQLite::Connection& connection, SQLite::rowid_t manifestRowId) const override; 24 std::vector<std::pair<SQLite::rowid_t, Utility::NormalizedString>> GetDependentsById(const SQLite::Connection& connection, AppInstaller::Manifest::string_t packageId) const override; 25 26 // Version 1.7 27 void DropTables(SQLite::Connection& connection) override; 28 29 protected: 30 bool NotNeeded(const SQLite::Connection& connection, std::string_view tableName, std::string_view valueName, SQLite::rowid_t id) const override; 31 32 private: 33 // Semantic check to validate dependencies with min versions are satisfied. 34 bool ValidateDependenciesWithMinVersions(const SQLite::Connection& connection, bool log) const; 35 }; 36 }