Skip to content

Commit 136380b

Browse files
committed
Fixed DEFAULT clause.
1 parent f3331d7 commit 136380b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Provider/src/FirebirdSql.EntityFrameworkCore.Firebird/Migrations/FbMigrationsSqlGenerator.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@
2222
using FirebirdSql.EntityFrameworkCore.Firebird.Metadata;
2323
using FirebirdSql.EntityFrameworkCore.Firebird.Metadata.Internal;
2424
using FirebirdSql.EntityFrameworkCore.Firebird.Migrations.Operations;
25+
using FirebirdSql.EntityFrameworkCore.Firebird.Storage.Internal;
2526
using Microsoft.EntityFrameworkCore.Infrastructure;
2627
using Microsoft.EntityFrameworkCore.Metadata;
2728
using Microsoft.EntityFrameworkCore.Migrations;
2829
using Microsoft.EntityFrameworkCore.Migrations.Operations;
30+
using Microsoft.EntityFrameworkCore.Storage;
2931

3032
namespace FirebirdSql.EntityFrameworkCore.Firebird.Migrations
3133
{
@@ -319,6 +321,21 @@ protected override void ColumnDefinition(string schema, string table, string nam
319321
}
320322
}
321323

324+
protected override void DefaultValue(object defaultValue, string defaultValueSql, MigrationCommandListBuilder builder)
325+
{
326+
if (defaultValueSql != null)
327+
{
328+
builder.Append(" DEFAULT ");
329+
builder.Append(defaultValueSql);
330+
}
331+
else if (defaultValue != null)
332+
{
333+
builder.Append(" DEFAULT ");
334+
var typeMapping = Dependencies.TypeMappingSource.GetMappingForValue(defaultValue);
335+
builder.Append(typeMapping.GenerateSqlLiteral(defaultValue));
336+
}
337+
}
338+
322339
protected override void ForeignKeyConstraint(AddForeignKeyOperation operation, IModel model, MigrationCommandListBuilder builder)
323340
{
324341
if (operation.Name != null)

0 commit comments

Comments
 (0)