87 lines
3.0 KiB
C#
87 lines
3.0 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Marco.Pms.DataAccess.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class Added_UIDPerfix_In_Expense_Table : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_AdvancePaymentTransactions_Projects_ProjectId",
|
|
table: "AdvancePaymentTransactions");
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "UIDPostfix",
|
|
table: "Expenses",
|
|
type: "int",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "UIDPrefix",
|
|
table: "Expenses",
|
|
type: "longtext",
|
|
nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AlterColumn<Guid>(
|
|
name: "ProjectId",
|
|
table: "AdvancePaymentTransactions",
|
|
type: "char(36)",
|
|
nullable: true,
|
|
collation: "ascii_general_ci",
|
|
oldClrType: typeof(Guid),
|
|
oldType: "char(36)")
|
|
.OldAnnotation("Relational:Collation", "ascii_general_ci");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_AdvancePaymentTransactions_Projects_ProjectId",
|
|
table: "AdvancePaymentTransactions",
|
|
column: "ProjectId",
|
|
principalTable: "Projects",
|
|
principalColumn: "Id");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_AdvancePaymentTransactions_Projects_ProjectId",
|
|
table: "AdvancePaymentTransactions");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "UIDPostfix",
|
|
table: "Expenses");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "UIDPrefix",
|
|
table: "Expenses");
|
|
|
|
migrationBuilder.AlterColumn<Guid>(
|
|
name: "ProjectId",
|
|
table: "AdvancePaymentTransactions",
|
|
type: "char(36)",
|
|
nullable: false,
|
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
|
collation: "ascii_general_ci",
|
|
oldClrType: typeof(Guid),
|
|
oldType: "char(36)",
|
|
oldNullable: true)
|
|
.OldAnnotation("Relational:Collation", "ascii_general_ci");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_AdvancePaymentTransactions_Projects_ProjectId",
|
|
table: "AdvancePaymentTransactions",
|
|
column: "ProjectId",
|
|
principalTable: "Projects",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
}
|
|
}
|