improved error handling, improved consistency of console error messages, added ability to add a Decimal column in Migrations

This commit is contained in:
Shaun Walker
2021-06-18 13:01:42 -04:00
parent 32c49f74d3
commit 3bc5744007
10 changed files with 53 additions and 23 deletions

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations.Operations;
using Microsoft.EntityFrameworkCore.Migrations.Operations.Builders;
@ -109,6 +110,16 @@ namespace Oqtane.Migrations.EntityBuilders
_migrationBuilder.AlterColumn<string>(RewriteName(name), RewriteName(EntityTableName), maxLength: length, nullable: nullable, unicode: unicode);
}
public void AddDecimalColumn(string name, int precision, int scale, bool nullable = false)
{
_migrationBuilder.AddColumn<decimal>(RewriteName(name), RewriteName(EntityTableName), nullable: nullable, precision: precision, scale: scale);
}
protected OperationBuilder<AddColumnOperation> AddDecimalColumn(ColumnsBuilder table, string name, int precision, int scale, bool nullable = false)
{
return table.Column<decimal>(name: RewriteName(name), nullable: nullable, precision: precision, scale: scale);
}
public void DropColumn(string name)
{
_migrationBuilder.DropColumn(RewriteName(name), RewriteName(EntityTableName));