-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Update database schema #39643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: current
Are you sure you want to change the base?
Update database schema #39643
Conversation
The database schema has changed slightly, a few columns and indices have been added in recent versions. This is the output of Home Assistant 2025.6.1.
✅ Deploy Preview for home-assistant-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughThe database schema was updated by adding new columns to several tables, changing the order of some columns, and reordering or introducing new indexes. The Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Database
Client->>Database: Alter table statistics_meta (add mean_type)
Client->>Database: Alter table statistics (add mean_weight)
Client->>Database: Alter table statistics_short_term (add mean_weight)
Client->>Database: Alter table states (move last_reported_ts)
Client->>Database: Drop migration_changes table
Client->>Database: Recreate migration_changes table at new position
Client->>Database: Add/reorder indexes on events, states, statistics, statistics_short_term
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
source/_docs/backend/database.markdown (2)
77-77
: Document and verify the newmean_type
column.
The addition ofmean_type INTEGER NOT NULL DEFAULT 0
is correct, but please add a brief description ofmean_type
in the prose above and confirm that the default value0
matches Home Assistant version 2025.6.1.
143-143
: Maintain one column per line in DDL for readability.
Split combined column declarations (metadata_id, last_reported_ts
,sum, mean_weight
) so each column appears on its own line, matching the existing style.Also applies to: 163-163, 181-181
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
📒 Files selected for processing (1)
source/_docs/backend/database.markdown
(5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Redirect rules - home-assistant-docs
- GitHub Check: Header rules - home-assistant-docs
- GitHub Check: Pages changed - home-assistant-docs
🔇 Additional comments (2)
source/_docs/backend/database.markdown (2)
206-206
: Approve new indexes and reordering.
The additions ofix_events_time_fired_ts
,ix_states_context_id_bin
,ix_states_last_updated_ts
,ix_statistics_start_ts
, and the reorderedix_statistics_short_term_statistic_id_start_ts
correctly reflect the updated schema for Home Assistant 2025.6.1.Also applies to: 210-210, 214-214, 220-220, 224-224
228-232
: Approve relocatedmigration_changes
table definition.
Moving theCREATE TABLE migration_changes
block to the end aligns with the actual table creation order in the current database schema.
Not a big change, but an updated schema on the documentation would have helped me to quicker find find the outdated info while trying to follow this community suggestion for migration back from postgres to sqlite. Therefore: Here is the update to the current version 2025.6.1. |
The database schema has changed slightly, a few columns and indices have been added in recent versions.
This is the output of Home Assistant 2025.6.1.
https://deploy-preview-39643--home-assistant-docs.netlify.app/docs/backend/database/
Proposed change
Type of change
current
branch).current
branch).next
branch).next
branch).Additional information
Checklist
current
branch.next
branch.Summary by CodeRabbit
New Features
Refactor