Skip to content

Commit

Permalink
Summary of the changes
Browse files Browse the repository at this point in the history
        - Generated SQL >> CREATE SEQUENCE wrong when using decimal
        was generating (18, 2) which SQL returned an error
        - Added tests for int, long, short, byte, decimal

Fixes #26562Summary of the changes

        - Generated SQL >> CREATE SEQUENCE wrong when using decimal
        was generating (18, 2) which SQL returned an error
        - Added tests for int, long, short, byte, decimal

Fixes #26562
  • Loading branch information
bobbyangers committed Nov 8, 2021
1 parent 252ece7 commit b452b54
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ protected override void Generate(

builder
.Append(" AS ")
.Append(typeMapping.StoreType);
.Append(typeMapping.StoreTypeNameBase);
}

builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1765,6 +1765,38 @@ public override async Task Create_sequence()
@"CREATE SEQUENCE [TestSequence] AS int START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE NO CYCLE;");
}

[ConditionalFact]
public async Task Create_sequence_decimal()
{
await Test(
builder => { },
builder => builder.HasSequence<decimal>("TestSequence"),
model =>
{
var sequence = Assert.Single(model.Sequences);
Assert.Equal("TestSequence", sequence.Name);
});

AssertSql(
@"CREATE SEQUENCE [TestSequence] AS decimal START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE NO CYCLE;");
}

[ConditionalFact]
public async Task Create_sequence_long()
{
await Test(
builder => { },
builder => builder.HasSequence<long>("TestSequence"),
model =>
{
var sequence = Assert.Single(model.Sequences);
Assert.Equal("TestSequence", sequence.Name);
});

AssertSql(
@"CREATE SEQUENCE [TestSequence] START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE NO CYCLE;");
}

public override async Task Create_sequence_all_settings()
{
await base.Create_sequence_all_settings();
Expand Down

0 comments on commit b452b54

Please sign in to comment.