iOS/Sources/Shared/Database/DatabaseTables.swift
Bruno Pantaleão Gonçalves 39be820fb9
Persist Entity and Device registry (#4157)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2026-01-06 04:00:08 +00:00

160 lines
3.6 KiB
Swift

import Foundation
public enum GRDBDatabaseTable: String {
case HAAppEntity = "hAAppEntity"
case watchConfig
case assistPipelines
case carPlayConfig
case appEntityRegistryListForDisplay
case appEntityRegistry
case appDeviceRegistry
case appPanel
case customWidget
case appArea
case homeViewConfiguration
// Dropped since 2025.2, now saved as json file
// Context: https://github.com/groue/GRDB.swift/issues/1626#issuecomment-2623927815
case clientEvent
}
public enum DatabaseTables {
public enum AppEntity: String, CaseIterable {
case id
case entityId
case serverId
case domain
case name
case icon
case rawDeviceClass
case hiddenBy
case disabledBy
}
public enum WatchConfig: String {
case id
case assist
case items
}
// Assist pipelines
public enum AssistPipelines: String {
case serverId
case preferredPipeline
case pipelines
}
// CarPlay configuration
public enum CarPlayConfig: String {
case id
case tabs
case quickAccessItems
}
// Table where it is store frontend related values such as
// precision for sensors
public enum AppEntityRegistryListForDisplay: String {
case id
case serverId
case entityId
case registry
}
// Sidebar dashboard panels
public enum AppPanel: String {
case id
case serverId
case icon
case title
case path
case component
case showInSidebar
}
public enum CustomWidget: String {
case id
case name
case items
case itemsStates
}
// Areas from Home Assistant
public enum AppArea: String {
case id
case serverId
case areaId
case name
case aliases
case picture
case icon
case entities
}
// Home View Configuration (per server)
public enum HomeViewConfiguration: String {
case id
case sectionOrder
case visibleSectionIds
case allowMultipleSelection
case entityOrderByRoom
case hiddenEntityIds
}
// Entity Registry (full entity registry data)
public enum EntityRegistry: String {
case id // Auto generated by GRDB (serverId-uniqueId)
case serverId
case uniqueId
case entityId
case platform
case configEntryId
case deviceId
case areaId
case disabledBy
case hiddenBy
case entityCategory
case name
case originalName
case icon
case originalIcon
case aliases
case labels
case deviceClass
case originalDeviceClass
case capabilities
case supportedFeatures
case unitOfMeasurement
case options
case translationKey
case hasEntityName
}
// Device Registry (full device registry data)
public enum DeviceRegistry: String {
case id // Auto generated by GRDB (serverId-deviceId)
case serverId
case deviceId
case areaId
case configurationURL
case configEntries
case configEntriesSubentries
case connections
case createdAt
case disabledBy
case entryType
case hwVersion
case identifiers
case labels
case manufacturer
case model
case modelID
case modifiedAt
case nameByUser
case name
case primaryConfigEntry
case serialNumber
case swVersion
case viaDeviceID
}
}