Commit 93b01a3
authored
Fix minimum schema version to run event_id_post_migration (#139014)
* Fix minimum version to run event_id_post_migration
The table rebuild to fix the foreign key constraint was added
in #120779 but the
schema version was not bumped so we need to make sure
any database that was created with schema 43 or older
still has the migration run as otherwise they will not
be able to purge the database with SQLite since each
delete in the events table will due a full table scan
of the states table to look for a foreign key that is
not there
fixes #138818
* Apply suggestions from code review
* Update homeassistant/components/recorder/migration.py
* Update homeassistant/components/recorder/migration.py
* Update homeassistant/components/recorder/const.py
* Apply suggestions from code review
* Apply suggestions from code review
* Apply suggestions from code review
* Apply suggestions from code review
* update tests, add more cover
* update tests, add more cover
* Update tests/components/recorder/test_migration_run_time_migrations_remember.py1 parent 98c6a57 commit 93b01a3
File tree
4 files changed
+68
-11
lines changed- homeassistant/components/recorder
- tests/components/recorder
4 files changed
+68
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
2490 | 2491 | | |
2491 | 2492 | | |
2492 | 2493 | | |
2493 | | - | |
| 2494 | + | |
2494 | 2495 | | |
2495 | 2496 | | |
| 2497 | + | |
2496 | 2498 | | |
2497 | 2499 | | |
2498 | 2500 | | |
| |||
2868 | 2870 | | |
2869 | 2871 | | |
2870 | 2872 | | |
2871 | | - | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
2872 | 2881 | | |
2873 | 2882 | | |
2874 | 2883 | | |
| |||
Lines changed: 11 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
| 228 | + | |
228 | 229 | | |
229 | 230 | | |
230 | 231 | | |
| |||
282 | 283 | | |
283 | 284 | | |
284 | 285 | | |
| 286 | + | |
285 | 287 | | |
286 | 288 | | |
287 | 289 | | |
| |||
588 | 590 | | |
589 | 591 | | |
590 | 592 | | |
| 593 | + | |
591 | 594 | | |
592 | 595 | | |
593 | 596 | | |
| |||
640 | 643 | | |
641 | 644 | | |
642 | 645 | | |
| 646 | + | |
643 | 647 | | |
644 | 648 | | |
645 | 649 | | |
| |||
1127 | 1131 | | |
1128 | 1132 | | |
1129 | 1133 | | |
| 1134 | + | |
1130 | 1135 | | |
1131 | 1136 | | |
1132 | 1137 | | |
| |||
1158 | 1163 | | |
1159 | 1164 | | |
1160 | 1165 | | |
1161 | | - | |
1162 | | - | |
1163 | | - | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
1164 | 1172 | | |
1165 | 1173 | | |
1166 | 1174 | | |
| |||
1169 | 1177 | | |
1170 | 1178 | | |
1171 | 1179 | | |
1172 | | - | |
1173 | 1180 | | |
1174 | 1181 | | |
1175 | 1182 | | |
| |||
Lines changed: 41 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
| 134 | + | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
| 146 | + | |
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
153 | 183 | | |
154 | 184 | | |
155 | 185 | | |
| |||
266 | 296 | | |
267 | 297 | | |
268 | 298 | | |
269 | | - | |
270 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
271 | 307 | | |
272 | 308 | | |
273 | 309 | | |
| |||
0 commit comments