-
Notifications
You must be signed in to change notification settings - Fork 12
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
Feature/1211 migrate device models from st table to database #1215
Feature/1211 migrate device models from st table to database #1215
Conversation
Codecov ReportBase: 88.16% // Head: 87.94% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1215 +/- ##
==========================================
- Coverage 88.16% 87.94% -0.22%
==========================================
Files 211 213 +2
Lines 6927 6944 +17
==========================================
Hits 6107 6107
- Misses 820 837 +17
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
foreach (var item in table.Query<TableEntity>().ToArray()) | ||
{ | ||
if (await set.AnyAsync(c => c.Id == item.RowKey)) | ||
continue; | ||
|
||
#pragma warning disable CS8629 // Nullable value type may be null. | ||
_ = await set.AddAsync(new DeviceModel | ||
{ | ||
Id = item.RowKey, | ||
Name = item[nameof(DeviceModel.Name)]?.ToString(), | ||
Description = item[nameof(DeviceModel.Description)]?.ToString(), | ||
IsBuiltin = bool.Parse(item[nameof(DeviceModel.IsBuiltin)]?.ToString() ?? "false"), | ||
SupportLoRaFeatures = bool.Parse(item[nameof(DeviceModel.SupportLoRaFeatures)]?.ToString() ?? "false"), | ||
ABPRelaxMode = bool.TryParse(item[nameof(DeviceModel.ABPRelaxMode)]?.ToString(), out var abpRelaxMode) ? abpRelaxMode : null, | ||
Deduplication = Enum.TryParse<DeduplicationMode>(item[nameof(DeviceModel.Deduplication)]?.ToString(), out var deduplication) ? deduplication : null, | ||
Downlink = bool.TryParse(item[nameof(DeviceModel.Downlink)]?.ToString(), out var downLink) ? downLink : null, | ||
KeepAliveTimeout = int.TryParse(item[nameof(DeviceModel.KeepAliveTimeout)]?.ToString(), out var keepAliveTimeout) ? keepAliveTimeout : null, | ||
PreferredWindow = int.TryParse(item[nameof(DeviceModel.PreferredWindow)]?.ToString(), out var preferredWindow) ? preferredWindow : null, | ||
RXDelay = int.TryParse(item[nameof(DeviceModel.PreferredWindow)]?.ToString(), out var rxDelay) ? rxDelay : null, | ||
UseOTAA = bool.TryParse(item[nameof(DeviceModel.UseOTAA)]?.ToString(), out var useOTAA) ? useOTAA : null, | ||
AppEUI = item[nameof(DeviceModel.AppEUI)]?.ToString(), | ||
SensorDecoder = item[nameof(DeviceModel.SensorDecoder)]?.ToString() | ||
}); | ||
#pragma warning restore CS8629 // Nullable value type may be null. | ||
|
||
if (config is ProductionConfigHandler) | ||
{ | ||
_ = await table.DeleteEntityAsync(item.PartitionKey, item.RowKey); | ||
} | ||
} |
Check notice
Code scanning / CodeQL
Missed opportunity to use Where
2088dd8
to
4f471b6
Compare
Description
What's new?
Remark : The column
SensorDecoderURL
in tableDeviceTemplates
won't be migrated. It is no more used by Portal and replaced by the columnSensorDecoder
What kind of change does this PR introduce?