Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static PropertyBuilder ForOracleUseSequenceHiLo(

if (model.Oracle().FindSequence(name, schema) == null)
{
model.Oracle().GetOrAddSequence(name, schema).IncrementBy = 10;
model.Oracle().GetOrAddSequence(name, schema).IncrementBy = 1;
}

GetOracleInternalBuilder(propertyBuilder).ValueGenerationStrategy(OracleValueGenerationStrategy.SequenceHiLo);
Expand Down
23 changes: 16 additions & 7 deletions src/OracleProvider/Migrations/Internal/OracleHistoryRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ public class OracleHistoryRepository : HistoryRepository
public OracleHistoryRepository([NotNull] HistoryRepositoryDependencies dependencies)
: base(dependencies)
{

}

protected override string TableName => base.TableName.Replace("_", "").ToUpper();
/// <summary>
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
Expand Down Expand Up @@ -67,17 +69,24 @@ public override string GetCreateIfNotExistsScript()
{
var builder = new IndentedStringBuilder();

return builder.Append(
@"BEGIN
EXECUTE IMMEDIATE '" + GetCreateScript() + @"';
EXCEPTION
WHEN OTHERS THEN
IF(SQLCODE != -942)THEN
RAISE;
var tableName = SqlGenerationHelper.DelimitIdentifier(TableName, TableSchema);
return builder.Append($@"
DECLARE
vCount NUMBER;
BEGIN
vCount := 0;
SELECT count(*) INTO vCount FROM ALL_TABLES WHERE OWNER = SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA') AND TABLE_NAME = '{tableName}';
IF (vCount <> 1) THEN
EXECUTE IMMEDIATE '{
GetCreateScript()
.Replace(";", string.Empty)
}';
END IF;
END;").ToString();

}


/// <summary>
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
Expand Down
Loading