-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DatabaseULog.write_ulog complained about wrong value types during struct packing.
- Loading branch information
1 parent
7c2df0f
commit af28fc6
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
BEGIN; | ||
PRAGMA foreign_keys=off; | ||
|
||
-- Change REAL timestamps to INT. SQLITE only supports INT64, but ULog -- changed from REAL | ||
-- timestamps are UINT64. We accept losing 1 bit at the top end, since 2^63 | ||
-- microseconds = 400,000 years. which should be enough. | ||
|
||
ALTER TABLE ULog RENAME COLUMN StartTimestamp TO StartTimestamp_old; | ||
ALTER TABLE ULog ADD COLUMN StartTimestamp INT; | ||
UPDATE ULog SET StartTimestamp = CAST(StartTimestamp_old AS INT); | ||
|
||
ALTER TABLE ULog RENAME COLUMN LastTimestamp TO LastTimestamp_old; | ||
ALTER TABLE ULog ADD COLUMN LastTimestamp INT; | ||
UPDATE ULog SET LastTimestamp = CAST(LastTimestamp_old AS INT); | ||
|
||
ALTER TABLE ULogMessageDropout RENAME COLUMN Timestamp TO Timestamp_old; | ||
ALTER TABLE ULogMessageDropout ADD COLUMN Timestamp INT; | ||
UPDATE ULogMessageDropout SET Timestamp = CAST(Timestamp_old AS INT); | ||
|
||
ALTER TABLE ULogMessageDropout RENAME COLUMN Duration TO Duration_old; | ||
ALTER TABLE ULogMessageDropout ADD COLUMN Duration INT; | ||
UPDATE ULogMessageDropout SET Duration = CAST(Duration_old AS INT); | ||
|
||
ALTER TABLE ULogMessageLogging RENAME COLUMN Timestamp TO Timestamp_old; | ||
ALTER TABLE ULogMessageLogging ADD COLUMN Timestamp INT; | ||
UPDATE ULogMessageLogging SET Timestamp = CAST(Timestamp_old AS INT); | ||
|
||
ALTER TABLE ULogMessageLoggingTagged RENAME COLUMN Timestamp TO Timestamp_old; | ||
ALTER TABLE ULogMessageLoggingTagged ADD COLUMN Timestamp INT; | ||
UPDATE ULogMessageLoggingTagged SET Timestamp = CAST(Timestamp_old AS INT); | ||
|
||
ALTER TABLE ULogChangedParameter RENAME COLUMN Timestamp TO Timestamp_old; | ||
ALTER TABLE ULogChangedParameter ADD COLUMN Timestamp INT; | ||
UPDATE ULogChangedParameter SET Timestamp = CAST(Timestamp_old AS INT); | ||
|
||
PRAGMA foreign_keys=on; | ||
COMMIT; |