Skip to content

Commit

Permalink
fix import bug, patch db schema name into dataset before StartSeeding
Browse files Browse the repository at this point in the history
  • Loading branch information
nstohler committed Aug 27, 2019
1 parent 873110a commit a78fbda
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Korzh.DbUtils.Import/DbImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public void Import()
if (datasetStream != null) {
_logger?.LogInformation($"Importing {table.Name}...");
var dataset = _datasetImporter.StartImport(datasetStream);

dataset.PatchDbSchema(table.Schema);

_dbWriter.StartSeeding(dataset);

while (_datasetImporter.HasRecords()) {
Expand Down
5 changes: 5 additions & 0 deletions src/Korzh.DbUtils/Abstractions/DatasetInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ public class DatasetInfo
/// <value>The schema name.</value>
public string Schema { get; private set; }

public void PatchDbSchema(string schema)
{
Schema = schema;
}

/// <summary>
/// Gets the directioary which contains all table columns.
/// The key of each entry is the name of the column.
Expand Down
5 changes: 5 additions & 0 deletions src/Korzh.DbUtils/DbBridge/BaseDbBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,11 @@ public void StartSeeding(DatasetInfo table)
/// </summary>
public void FinishSeeding()
{
if(CurrentSeedingTable == null)
{
return;
}

TurnOnConstraints();
TurnOnAutoIncrement();
Logger?.LogDebug("Finish seeding: " + GetTableFullName(CurrentSeedingTable));
Expand Down

0 comments on commit a78fbda

Please sign in to comment.