Skip to content
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

Add migration of device model commands from st table to database #1209 #1210

Conversation

hocinehacherouf
Copy link
Contributor

Description

What's new?

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Tests
  • Other

@hocinehacherouf hocinehacherouf changed the title Add migration of device tags from st table to database #1209 Add migration of device model commands from st table to database #1209 Sep 11, 2022
@hocinehacherouf hocinehacherouf force-pushed the feature/1209_migrate_device_model_commands_from_st_table_to_database branch from 2048342 to acf562f Compare September 11, 2022 15:08
@codecov
Copy link

codecov bot commented Sep 11, 2022

Codecov Report

Base: 88.23% // Head: 88.16% // Decreases project coverage by -0.07% ⚠️

Coverage data is based on head (acf562f) compared to base (2cd519f).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1210      +/-   ##
==========================================
- Coverage   88.23%   88.16%   -0.08%     
==========================================
  Files         210      211       +1     
  Lines        6921     6927       +6     
==========================================
  Hits         6107     6107              
- Misses        814      820       +6     
Impacted Files Coverage Δ
...IoTHubPortal.Domain/Entities/DeviceModelCommand.cs 0.00% <0.00%> (ø)

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

Comment on lines +22 to +43
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 DeviceModelCommand
{
Id = item.RowKey,
Frame = item[nameof(DeviceModelCommand.Frame)].ToString(),
Port = int.Parse(item[nameof(DeviceModelCommand.Port)].ToString(), CultureInfo.InvariantCulture),
IsBuiltin = bool.Parse(item[nameof(DeviceModelCommand.IsBuiltin)]?.ToString() ?? "false"),
Confirmed = bool.Parse(item[nameof(DeviceModelCommand.Confirmed)]?.ToString() ?? "false"),
DeviceModelId = item.PartitionKey
});
#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

This foreach loop implicitly filters its target sequence [here](1) - consider filtering the sequence explicitly using '.Where(...)'.
@hocinehacherouf hocinehacherouf marked this pull request as ready for review September 11, 2022 15:23
@hocinehacherouf hocinehacherouf requested a review from a team as a code owner September 11, 2022 15:23
@kbeaugrand kbeaugrand merged commit 8771382 into main Sep 11, 2022
@kbeaugrand kbeaugrand deleted the feature/1209_migrate_device_model_commands_from_st_table_to_database branch September 11, 2022 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate device model commands from storage account table to database
2 participants